diff --git a/app/web/src/render/live/live.tsx b/app/web/src/render/live/live.tsx
index afb6b7c3..4444f4c3 100644
--- a/app/web/src/render/live/live.tsx
+++ b/app/web/src/render/live/live.tsx
@@ -65,7 +65,7 @@ export const Live: FC<{
routeLive(p, pathname);
}
- if (!p.mode) return ;
+ if (!p.mode) return ;
else {
w.isMobile = p.mode === "mobile";
w.isDesktop = p.mode === "desktop";
diff --git a/package.json b/package.json
index 8ca2908f..83e42848 100644
--- a/package.json
+++ b/package.json
@@ -6,6 +6,7 @@
"dev": "bun run --hot --silent ./pkgs/core/index.ts dev",
"clean": "rm -rf data && rm -rf app/static && rm -rf app/web/.parcel-cache",
"build": "bun run --silent ./pkgs/core/build.ts",
+ "build-site": "bun run --silent ./pkgs/core/build-site.ts",
"db-pull": "bun run ./pkgs/core/db-pull.ts",
"parcel": "bun clean && bun run ./pkgs/core/parcel.ts",
"prod": "bun run --silent ./pkgs/core/index.ts",
diff --git a/pkgs/core/build-site.ts b/pkgs/core/build-site.ts
new file mode 100644
index 00000000..f1a63d72
--- /dev/null
+++ b/pkgs/core/build-site.ts
@@ -0,0 +1,53 @@
+import { dir } from "dir";
+import { Plugin, context } from "esbuild";
+import { $ } from "execa";
+import { removeAsync, writeAsync } from "fs-jetpack";
+
+await removeAsync(dir.path("app/srv/site"));
+const onEndPlugin: Plugin = {
+ name: "on-end",
+ setup(build) {
+ build.onEnd(async (result) => {
+ console.log("Compressing deploy");
+ await removeAsync(dir.path("app/srv/site.zip"));
+ await $({ cwd: dir.path("app/srv") })`zip -r site.zip site`;
+ process.exit(0);
+ });
+ },
+};
+
+console.log("Building deploy");
+const ctx = await context({
+ bundle: true,
+ absWorkingDir: dir.path(""),
+ entryPoints: [dir.path("app/web/src/render/site/site.tsx")],
+ outdir: dir.path("app/srv/site"),
+ splitting: true,
+ format: "esm",
+ jsx: "transform",
+ minify: true,
+ sourcemap: true,
+ logLevel: "error",
+ plugins: [onEndPlugin],
+ define: {
+ "process.env.NODE_ENV": `"production"`,
+ },
+});
+await ctx.rebuild();
+await writeAsync(
+ dir.path("app/srv/site/index.html"),
+ `
+
+
+
+
+
+
+
+
+
+
+
+
+`
+);
diff --git a/pkgs/core/build.ts b/pkgs/core/build.ts
index 2d2648af..948124a6 100644
--- a/pkgs/core/build.ts
+++ b/pkgs/core/build.ts
@@ -1,17 +1,14 @@
import brotliPromise from "brotli-wasm";
import { spawn } from "bun";
import { dir } from "dir";
-import { Plugin, context } from "esbuild";
-import { $ } from "execa";
import { fdir } from "fdir";
import { statSync } from "fs";
import {
+ copyAsync,
+ existsAsync,
listAsync,
removeAsync,
writeAsync,
- inspectTree,
- existsAsync,
- copyAsync,
} from "fs-jetpack";
const brotli = await brotliPromise;
@@ -101,54 +98,4 @@ if (files) {
}
}
-const buildSite = async () => {
- await removeAsync(dir.path("app/srv/site"));
- const onEndPlugin: Plugin = {
- name: "on-end",
- setup(build) {
- build.onEnd(async (result) => {
- console.log("Compressing deploy");
- await removeAsync(dir.path("app/srv/site.zip"));
- await $({ cwd: dir.path("app/srv") })`zip -r site.zip site`;
- process.exit(0);
- });
- },
- };
-
- console.log("Building deploy");
- const ctx = await context({
- bundle: true,
- absWorkingDir: dir.path(""),
- entryPoints: [dir.path("app/web/src/render/site/site.tsx")],
- outdir: dir.path("app/srv/site"),
- splitting: true,
- format: "esm",
- jsx: "transform",
- minify: true,
- sourcemap: true,
- logLevel: "error",
- plugins: [onEndPlugin],
- define: {
- "process.env.NODE_ENV": `"production"`,
- },
- });
- await ctx.rebuild();
- await writeAsync(
- dir.path("app/srv/site/index.html"),
- `
-
-
-
-
-
-
-
-
-
-
-
-
-`
- );
-};
-await buildSite();
+await import("./build-site");