This commit is contained in:
Rizky 2023-10-16 11:42:09 +07:00
parent 19b894c3b5
commit a3bc388218
4 changed files with 9 additions and 6 deletions

View File

@ -1,2 +1,2 @@
bun run build
ssh plansys@web.andromedia.co.id "cd /home/plansys/"
ssh plansys@web.andromedia.co.id "cd /home/plansys/prasi/app && bun run deploy"

View File

@ -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"),

View File

@ -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...");

View File

@ -2,7 +2,8 @@
"exclude": [
".git",
"node_modules",
"app/static"
"app/static",
"app/web/static",
],
"compilerOptions": {
"lib": [