diff --git a/deploy.sh b/deploy.sh index 96e3c221..417d45fc 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,2 +1,2 @@ bun run build -ssh plansys@web.andromedia.co.id "cd /home/plansys/" \ No newline at end of file +ssh plansys@web.andromedia.co.id "cd /home/plansys/prasi/app && bun run deploy" diff --git a/pkgs/core/build.ts b/pkgs/core/build.ts index 6be70f17..7ebc8680 100644 --- a/pkgs/core/build.ts +++ b/pkgs/core/build.ts @@ -1,10 +1,11 @@ import { spawn } from "bun"; import { dir } from "dir"; -import { dirAsync, removeAsync } from "fs-jetpack"; -import { g } from "utils/global"; +import { removeAsync } from "fs-jetpack"; await removeAsync(dir.path("app/static")); await removeAsync(dir.path("app/web/.parcel-cache")); +await removeAsync(dir.path("app/web/static")); + const args = [ "node", dir.path("node_modules/.bin/parcel"), diff --git a/pkgs/core/server/create.ts b/pkgs/core/server/create.ts index 271799bf..4411585c 100644 --- a/pkgs/core/server/create.ts +++ b/pkgs/core/server/create.ts @@ -80,6 +80,7 @@ export const createServer = async () => { g.log.error(e); } + const webPath = g.mode === "dev" ? "app/static" : "app/web/static"; try { const found = cache.static[url.pathname]; if (found && g.mode === "prod") { @@ -87,7 +88,7 @@ export const createServer = async () => { res.headers.set("Content-Type", found.type); } - const file = Bun.file(dir.path(`app/static${url.pathname}`)); + const file = Bun.file(dir.path(`${webPath}${url.pathname}`)); if ((await file.exists()) && file.type !== "application/octet-stream") { cache.static[url.pathname] = { type: file.type, @@ -101,7 +102,7 @@ export const createServer = async () => { } try { - return new Response(Bun.file(dir.path(`app/static/index.html`)) as any); + return new Response(Bun.file(dir.path(`${webPath}/index.html`)) as any); } catch (e) { g.log.error(e); return new Response("Loading..."); diff --git a/tsconfig.json b/tsconfig.json index b7a3b708..bd06088a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,8 @@ "exclude": [ ".git", "node_modules", - "app/static" + "app/static", + "app/web/static", ], "compilerOptions": { "lib": [