From 9331eaeec1e285e6d2dbc338c5d2f8b1522a427d Mon Sep 17 00:00:00 2001
From: hotsocket
Date: Fri, 5 Sep 2025 03:48:34 -0500
Subject: [PATCH] index generation, CI
---
.gitignore | 3 +++
.tangled/pipelines/netlify.yml | 18 ++++++++++++++++++
flake.nix | 2 +-
package.json | 5 +++--
scripts/index.ts | 31 +++++++++++++++++++++++++++++++
static/desktop.html | 2 +-
6 files changed, 57 insertions(+), 4 deletions(-)
create mode 100644 .tangled/pipelines/netlify.yml
create mode 100644 scripts/index.ts
diff --git a/.gitignore b/.gitignore
index d421232..d0e8eac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,6 @@
out
node_modules
certs
+
+# Local Netlify folder
+.netlify
diff --git a/.tangled/pipelines/netlify.yml b/.tangled/pipelines/netlify.yml
new file mode 100644
index 0000000..728992c
--- /dev/null
+++ b/.tangled/pipelines/netlify.yml
@@ -0,0 +1,18 @@
+#
+when:
+ - event: ["push", "manual"]
+ branch: ["main"]
+
+engine: "nixery"
+
+dependencies:
+ nixpkgs:
+ - deno
+ - rsync
+ - netlify-cli
+
+steps:
+ - name: "Build output"
+ command: "deno task build-prod"
+ - name: "Push to Netlify"
+ command: "netlify deploy --prod --site=domlink --dir=out"
diff --git a/flake.nix b/flake.nix
index 6c90755..3d7a9f5 100644
--- a/flake.nix
+++ b/flake.nix
@@ -11,7 +11,7 @@
in {
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
- deno rsync
+ deno rsync netlify-cli
];
};
}
diff --git a/package.json b/package.json
index b64cb57..7cf48b1 100644
--- a/package.json
+++ b/package.json
@@ -15,8 +15,9 @@
},
"scripts": {
"serve": "http-server ./out -C",
- "build": "deno bundle --platform=browser src/*.ts --outdir=out --sourcemap=inline && rsync -av static/ out/",
- "build-prod": "deno bundle --platform=browser src/*.ts --outdir=out --minify && rsync -av static/ out/",
+ "script_index": "deno run --allow-read --allow-write scripts/index.ts",
+ "build": "deno task script_index && deno bundle --platform=browser src/*.ts --outdir=out --sourcemap=inline && rsync -av static/ out/",
+ "build-prod": "deno task script_index && deno bundle --platform=browser src/*.ts --outdir=out --minify && rsync -av static/ out/",
"test": "deno test test/**/*.ts"
}
}
diff --git a/scripts/index.ts b/scripts/index.ts
new file mode 100644
index 0000000..469ab61
--- /dev/null
+++ b/scripts/index.ts
@@ -0,0 +1,31 @@
+// generates index of html files in static
+
+let output = `
+
+
+
+
+
+ DomLink Index
+
+
+
+ DomLink HTML File Index
+ `;
+for (const dirEntry of Deno.readDirSync("./static")) {
+ if (dirEntry.isFile && dirEntry.name.endsWith(".html")) {
+ // oh shit that indentation lines up
+ const currentFile = Deno.readTextFileSync(`./static/${dirEntry.name}`);
+ const title = currentFile.split("\n").find(x=>x.includes(""))!.split("")[1].split("")[0];
+ output = output + `
+ - ${title} (${dirEntry.name})
`;
+ }
+}
+output = output + `
+
+
+`;
+
+const outfile = Deno.openSync("./out/index.html", {create: true, write: true, append: false});
+outfile.writeSync(new TextEncoder().encode(output));
+outfile.close();
diff --git a/static/desktop.html b/static/desktop.html
index 8083cf1..65158e9 100644
--- a/static/desktop.html
+++ b/static/desktop.html
@@ -3,7 +3,7 @@
- desktop
+ ==>DESKTOP<==
--
2.51.2
|