Refactor Server Paradigm.
This commit is contained in:
Vendored
+4
-4
@@ -1,23 +1,23 @@
|
||||
import { Command } from "commander";
|
||||
import { log } from "../../utils/log";
|
||||
import init from "../../functions/init";
|
||||
import rewritePagesModule from "../../utils/rewrite-pages-module";
|
||||
// import rewritePagesModule from "../../utils/rewrite-pages-module";
|
||||
import allPagesBunBundler from "../../functions/bundler/all-pages-bun-bundler";
|
||||
import grabDirNames from "../../utils/grab-dir-names";
|
||||
import { rmSync } from "fs";
|
||||
import allPagesBundler from "../../functions/bundler/all-pages-bundler";
|
||||
const { HYDRATION_DST_DIR, BUNX_CWD_PAGES_REWRITE_DIR } = grabDirNames();
|
||||
export default function () {
|
||||
return new Command("build")
|
||||
.description("Build Project")
|
||||
.action(async () => {
|
||||
process.env.NODE_ENV = "production";
|
||||
process.env.BUILD = "true";
|
||||
try {
|
||||
rmSync(HYDRATION_DST_DIR, { recursive: true });
|
||||
rmSync(BUNX_CWD_PAGES_REWRITE_DIR, { recursive: true });
|
||||
}
|
||||
catch (error) { }
|
||||
await rewritePagesModule();
|
||||
global.SKIPPED_BROWSER_MODULES = new Set();
|
||||
// await rewritePagesModule();
|
||||
await init();
|
||||
log.banner();
|
||||
log.build("Building Project ...");
|
||||
|
||||
Vendored
+2
-2
@@ -2,9 +2,9 @@ import { Command } from "commander";
|
||||
import startServer from "../../functions/server/start-server";
|
||||
import { log } from "../../utils/log";
|
||||
import bunextInit from "../../functions/bunext-init";
|
||||
import rewritePagesModule from "../../utils/rewrite-pages-module";
|
||||
import grabDirNames from "../../utils/grab-dir-names";
|
||||
import { rmSync } from "fs";
|
||||
import allPagesBunBundler from "../../functions/bundler/all-pages-bun-bundler";
|
||||
const { HYDRATION_DST_DIR, BUNX_CWD_PAGES_REWRITE_DIR } = grabDirNames();
|
||||
export default function () {
|
||||
return new Command("dev")
|
||||
@@ -17,8 +17,8 @@ export default function () {
|
||||
rmSync(BUNX_CWD_PAGES_REWRITE_DIR, { recursive: true });
|
||||
}
|
||||
catch (error) { }
|
||||
await rewritePagesModule();
|
||||
await bunextInit();
|
||||
await allPagesBunBundler();
|
||||
await startServer();
|
||||
});
|
||||
}
|
||||
|
||||
Vendored
+2
-1
@@ -2,13 +2,14 @@ import { Command } from "commander";
|
||||
import startServer from "../../functions/server/start-server";
|
||||
import { log } from "../../utils/log";
|
||||
import bunextInit from "../../functions/bunext-init";
|
||||
import allPagesBunBundler from "../../functions/bundler/all-pages-bun-bundler";
|
||||
export default function () {
|
||||
return new Command("start")
|
||||
.description("Start production server")
|
||||
.action(async () => {
|
||||
process.env.NODE_ENV = "production";
|
||||
log.info("Starting production server ...");
|
||||
await bunextInit();
|
||||
await allPagesBunBundler();
|
||||
await startServer();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user