This commit is contained in:
2026-02-26 04:08:06 +01:00
parent 8177df7dd3
commit f7c0e927c7
39 changed files with 1003 additions and 306 deletions
-13
View File
@@ -1,13 +0,0 @@
import { Command } from "commander";
import grabConfig from "../../functions/grab-config";
export default function () {
return new Command("build")
.description("Build project")
.action(async () => {
console.log(`Building project ...`);
const config = await grabConfig();
global.CONFIG = config;
});
}
+11 -29
View File
@@ -1,7 +1,8 @@
import { Command } from "commander";
import grabConfig from "../../functions/grab-config";
import grabDirNames from "../../utils/grab-dir-names";
import AppNames from "../../utils/grab-app-names";
import grabConfig from "../../src/functions/grab-config";
import startServer from "../../src/functions/server/start-server";
import init from "../../src/functions/init";
import type { BunextConfig } from "../../src/types";
export default function () {
return new Command("dev")
@@ -9,34 +10,15 @@ export default function () {
.action(async () => {
console.log(`Running development server ...`);
const config = await grabConfig();
global.CONFIG = config;
await init();
const { entrypoint } = grabDirNames();
const { defaultDistDir } = AppNames;
const config: BunextConfig = (await grabConfig()) || {};
let buildCmd = ["bun"];
global.CONFIG = {
...config,
development: true,
};
buildCmd.push(
"build",
entrypoint,
"--outdir",
config.distDir || defaultDistDir,
"--watch"
);
const spawnedProcess = Bun.spawn({
cmd: buildCmd,
});
const exitCode = await spawnedProcess.exited;
// Bun.build({
// entrypoints: [entrypoint],
// outdir: config.distDir || defaultDistDir,
// minify: true,
// });
// await startServer();
await startServer({ dev: true });
});
}
-10
View File
@@ -1,10 +0,0 @@
import { Command } from "commander";
import AppNames from "../../utils/grab-app-names";
export default function () {
return new Command("init")
.description("Initialize project")
.action(async () => {
console.log(`Initializing ${AppNames.name} ...`);
});
}
+9 -2
View File
@@ -1,5 +1,7 @@
import { Command } from "commander";
import grabConfig from "../../functions/grab-config";
import grabConfig from "../../src/functions/grab-config";
import startServer from "../../src/functions/server/start-server";
import init from "../../src/functions/init";
export default function () {
return new Command("start")
@@ -7,7 +9,12 @@ export default function () {
.action(async () => {
console.log(`Starting production server ...`);
await init();
const config = await grabConfig();
global.CONFIG = config;
global.CONFIG = { ...config };
await startServer();
});
}