Update init function
This commit is contained in:
parent
7dbd1f7e12
commit
48c25d2fb4
4
dist/commands/dev/index.js
vendored
4
dist/commands/dev/index.js
vendored
@ -20,10 +20,6 @@ export default function () {
|
||||
}
|
||||
catch (error) { }
|
||||
await bunextInit();
|
||||
// await allPagesBunBundler();
|
||||
await allPagesESBuildContextBundler({
|
||||
post_build_fn: serverPostBuildFn,
|
||||
});
|
||||
await startServer();
|
||||
});
|
||||
}
|
||||
|
||||
4
dist/commands/start/index.js
vendored
4
dist/commands/start/index.js
vendored
@ -2,8 +2,6 @@ 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";
|
||||
import allPagesESBuildContextBundler from "../../functions/bundler/all-pages-esbuild-context-bundler";
|
||||
export default function () {
|
||||
return new Command("start")
|
||||
.description("Start production server")
|
||||
@ -11,8 +9,6 @@ export default function () {
|
||||
process.env.NODE_ENV = "production";
|
||||
log.info("Starting production server ...");
|
||||
await bunextInit();
|
||||
// await allPagesBunBundler();
|
||||
await allPagesESBuildContextBundler();
|
||||
await startServer();
|
||||
});
|
||||
}
|
||||
|
||||
@ -50,6 +50,7 @@ export default async function allPagesESBuildContextBundler(params) {
|
||||
],
|
||||
jsx: "automatic",
|
||||
splitting: true,
|
||||
treeShaking: true,
|
||||
logLevel: "silent",
|
||||
// logLevel: "silent",
|
||||
// logLevel: dev ? "error" : "silent",
|
||||
|
||||
6
dist/functions/bunext-init.js
vendored
6
dist/functions/bunext-init.js
vendored
@ -5,6 +5,8 @@ import isDevelopment from "../utils/is-development";
|
||||
import { log } from "../utils/log";
|
||||
import cron from "./server/cron";
|
||||
import watcherEsbuildCTX from "./server/watcher-esbuild-ctx";
|
||||
import allPagesESBuildContextBundler from "./bundler/all-pages-esbuild-context-bundler";
|
||||
import serverPostBuildFn from "./server/server-post-build-fn";
|
||||
const dirNames = grabDirNames();
|
||||
const { PAGES_DIR } = dirNames;
|
||||
export default async function bunextInit() {
|
||||
@ -23,9 +25,13 @@ export default async function bunextInit() {
|
||||
global.ROUTER = router;
|
||||
const is_dev = isDevelopment();
|
||||
if (is_dev) {
|
||||
await allPagesESBuildContextBundler({
|
||||
post_build_fn: serverPostBuildFn,
|
||||
});
|
||||
watcherEsbuildCTX();
|
||||
}
|
||||
else {
|
||||
await allPagesESBuildContextBundler();
|
||||
cron();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "@moduletrace/bunext",
|
||||
"module": "index.ts",
|
||||
"type": "module",
|
||||
"version": "1.0.44",
|
||||
"version": "1.0.45",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"exports": {
|
||||
|
||||
@ -25,12 +25,6 @@ export default function () {
|
||||
|
||||
await bunextInit();
|
||||
|
||||
// await allPagesBunBundler();
|
||||
|
||||
await allPagesESBuildContextBundler({
|
||||
post_build_fn: serverPostBuildFn,
|
||||
});
|
||||
|
||||
await startServer();
|
||||
});
|
||||
}
|
||||
|
||||
@ -2,8 +2,6 @@ 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";
|
||||
import allPagesESBuildContextBundler from "../../functions/bundler/all-pages-esbuild-context-bundler";
|
||||
|
||||
export default function () {
|
||||
return new Command("start")
|
||||
@ -14,9 +12,6 @@ export default function () {
|
||||
|
||||
await bunextInit();
|
||||
|
||||
// await allPagesBunBundler();
|
||||
await allPagesESBuildContextBundler();
|
||||
|
||||
await startServer();
|
||||
});
|
||||
}
|
||||
|
||||
@ -73,6 +73,7 @@ export default async function allPagesESBuildContextBundler(params?: Params) {
|
||||
],
|
||||
jsx: "automatic",
|
||||
splitting: true,
|
||||
treeShaking: true,
|
||||
logLevel: "silent",
|
||||
// logLevel: "silent",
|
||||
// logLevel: dev ? "error" : "silent",
|
||||
|
||||
@ -13,6 +13,8 @@ import { log } from "../utils/log";
|
||||
import cron from "./server/cron";
|
||||
import type { BuildContext } from "esbuild";
|
||||
import watcherEsbuildCTX from "./server/watcher-esbuild-ctx";
|
||||
import allPagesESBuildContextBundler from "./bundler/all-pages-esbuild-context-bundler";
|
||||
import serverPostBuildFn from "./server/server-post-build-fn";
|
||||
|
||||
/**
|
||||
* # Declare Global Variables
|
||||
@ -60,8 +62,12 @@ export default async function bunextInit() {
|
||||
const is_dev = isDevelopment();
|
||||
|
||||
if (is_dev) {
|
||||
await allPagesESBuildContextBundler({
|
||||
post_build_fn: serverPostBuildFn,
|
||||
});
|
||||
watcherEsbuildCTX();
|
||||
} else {
|
||||
await allPagesESBuildContextBundler();
|
||||
cron();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user