checkpoint
This commit is contained in:
parent
683a050de8
commit
d12b850a75
|
|
@ -0,0 +1,5 @@
|
|||
import { g } from "utils/global";
|
||||
|
||||
export const PrasiContent = () => {
|
||||
return g.mode === "site" ? g.content : null;
|
||||
};
|
||||
|
|
@ -7,7 +7,7 @@ import { fs } from "utils/fs";
|
|||
import { g } from "utils/global";
|
||||
|
||||
export const loadCurrentDeploy = async (ts: number) => {
|
||||
if (fs.exists(`site:deploy/current/${ts}.gz`)) {
|
||||
if (fs.exists(`site:deploy/current/${ts}.gz`) && g.mode === "site") {
|
||||
await removeAsync(fs.path(`site:deploy/current/files`));
|
||||
|
||||
const content = decode(
|
||||
|
|
|
|||
|
|
@ -1,10 +1,28 @@
|
|||
import { config } from "utils/config";
|
||||
import { g, startup } from "utils/global";
|
||||
import { prasi_content_ipc } from "../content/content-ipc";
|
||||
import { prasi_content_deploy } from "../content/content-deploy";
|
||||
import { loadCurrentDeploy } from "../content/deploy/load";
|
||||
|
||||
startup("site", async () => {
|
||||
await config.init("site:site.json");
|
||||
const ts = config.current?.deploy.current;
|
||||
if (ts) {
|
||||
// g.server = process.argv.includes("--ipc") ? "ipc" : "gz";
|
||||
if (g.mode === "site") {
|
||||
g.content = g.ipc ? prasi_content_ipc : prasi_content_deploy;
|
||||
|
||||
if (g.ipc) {
|
||||
} else {
|
||||
const ts = config.current?.deploy.current;
|
||||
if (ts) {
|
||||
await loadCurrentDeploy(ts);
|
||||
}
|
||||
}
|
||||
|
||||
g.server = Bun.serve({
|
||||
fetch(request, server) {},
|
||||
websocket: { message(ws, message) {} },
|
||||
});
|
||||
|
||||
if (g.ipc) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ startup("supervisor", async () => {
|
|||
if (is_ipc) {
|
||||
g.mode = "site";
|
||||
if (g.mode === "site") g.ipc = true;
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
startServer({
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import { join, resolve } from "path";
|
|||
import type { SiteConfig } from "./config";
|
||||
import { fs } from "./fs";
|
||||
import type { PrasiSpawn, spawn } from "./spawn";
|
||||
import type { prasi_content_ipc } from "../content/content-ipc";
|
||||
import type { prasi_content_deploy } from "../content/content-deploy";
|
||||
|
||||
if (!(globalThis as any).prasi) {
|
||||
(globalThis as any).prasi = {};
|
||||
|
|
@ -15,7 +17,8 @@ export const g = (globalThis as any).prasi as unknown as {
|
|||
mode: "site";
|
||||
server: Server;
|
||||
ipc: boolean;
|
||||
site: {
|
||||
content: typeof prasi_content_ipc & typeof prasi_content_deploy;
|
||||
site?: {
|
||||
db?: SiteConfig["db"];
|
||||
layouts: {
|
||||
id: string;
|
||||
|
|
|
|||
Loading…
Reference in New Issue