import { setEnv } from "../../lib/sys.mjs";
export default (cli) =>
cli
.command("[root]", "start server in development mode", {
ignoreOptionDefaultValue: true,
})
.option("--host [host]", "[string] host to listen on", {
default: "localhost",
})
.option("--port <port>", "[number] port to listen on", { default: 3000 })
.option("--https", "[boolean] use HTTPS protocol", { default: false })
.option("--cors", "enable CORS", { default: false })
.option("--origin <origin>", "[string] origin", { default: "" })
.option("--trust-proxy", "[boolean] trust proxy", { default: false })
.option("--open [url]", "[boolean|string] open browser on server start", {
default: false,
})
.option("--force", "force optimize deps", { default: false })
.option("--watch", "watch for config changes", { default: true })
.option("--clear-screen", "clear screen on server start", {
default: false,
})
.option("--no-color", "disable color output", { default: false })
.option("--no-check", "skip dependency checks", { default: false })
.option("--no-validation", "skip config validation", { default: false })
.option(
"-e, --eval [code]",
"evaluate code as the server entrypoint; pass without a value to read from stdin"
)
.option("-o, --outDir <dir>", "[string] output directory", {
default: ".react-server",
})
.option("-n, --name <name>", "[string] server name", {
default: "react-server",
})
.option("--devtools", "enable built-in devtools", { default: false })
.option("--inspect", "enable inspector", { default: false })
.option("--mode <mode>", "[string] mode", { default: "development" })
.action(async (...args) => {
setEnv("NODE_ENV", "development");
const { default: init$ } = await import("../../lib/loader/init.mjs");
await init$({ command: "dev" });
return (await import("../../lib/dev/action.mjs")).default(...args);
});