mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-02 08:06:00 +00:00
dev: add main inject plugin
This commit is contained in:
@@ -1,17 +1,27 @@
|
||||
import type { CliCommand } from "cli/types";
|
||||
import { Option } from "commander";
|
||||
import { withConfigOptions, type WithConfigOptions } from "cli/utils/options";
|
||||
import * as utils from "./utils";
|
||||
import { $console } from "core/utils";
|
||||
import { Project } from "./lib/Project";
|
||||
|
||||
export const dev: CliCommand = (program) =>
|
||||
withConfigOptions(program.command("dev")).description("dev server").action(action);
|
||||
withConfigOptions(program.command("dev"))
|
||||
.description("dev server")
|
||||
.addOption(new Option("--build", "build the project"))
|
||||
.action(action);
|
||||
|
||||
async function action(options: WithConfigOptions<{}>) {
|
||||
async function action(options: WithConfigOptions<{ build?: boolean }>) {
|
||||
console.log("options", options);
|
||||
const project = new Project({
|
||||
templatePath: utils.TEMPLATE_PATH,
|
||||
});
|
||||
|
||||
await project.init();
|
||||
|
||||
if (options.build) {
|
||||
await project.build();
|
||||
process.exit(0);
|
||||
}
|
||||
await project.listen();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user