feat: add reusable public chrome and named environments
This commit is contained in:
@@ -47,6 +47,7 @@ Usage:
|
||||
Add an app to the current workspace
|
||||
wrnexus gateway [--port=3000] Serve every workspace app behind one port, routed by domain
|
||||
wrnexus production [workspace-dir] Build, migrate, and serve the complete production workspace
|
||||
wrnexus <environment> [workspace-dir] Run a configured workspace environment (development/staging/custom)
|
||||
wrnexus generate <type> <name> Scaffold a page | component | api | schema
|
||||
wrnexus generate routes | docker | mobile
|
||||
Generate routes or scaffold deployment targets
|
||||
@@ -195,10 +196,32 @@ async function main(): Promise<void> {
|
||||
case "-h":
|
||||
help();
|
||||
break;
|
||||
default:
|
||||
console.error(`Unknown command: ${command}\n`);
|
||||
help();
|
||||
process.exit(1);
|
||||
default: {
|
||||
const { loadWorkspaceConfig, runGateway, runProduction } = await import("./workspace.ts");
|
||||
const workspaceRoot = rest.find((a) => !a.startsWith("--")) ?? ".";
|
||||
try {
|
||||
const workspace = await loadWorkspaceConfig(resolve(workspaceRoot));
|
||||
const knownEnvironments = new Set([
|
||||
"development",
|
||||
"production",
|
||||
workspace.defaultEnvironment,
|
||||
...Object.keys(workspace.environments ?? {}),
|
||||
]);
|
||||
if (!knownEnvironments.has(command)) throw new Error("unknown-environment-command");
|
||||
const environmentArgs = rest.filter((arg) => arg !== workspaceRoot);
|
||||
environmentArgs.push(`--environment=${command}`);
|
||||
if (command === "development") {
|
||||
await runGateway(workspaceRoot, environmentArgs);
|
||||
} else {
|
||||
await runProduction(workspaceRoot, environmentArgs);
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof Error && error.message !== "unknown-environment-command") throw error;
|
||||
console.error(`Unknown command or workspace environment: ${command}\n`);
|
||||
help();
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user