feat: configure workspace environment runtimes

This commit is contained in:
2026-07-20 09:22:26 +05:30
parent 3888453e0d
commit b3e5e5b999
58 changed files with 183 additions and 103 deletions
+28
View File
@@ -6,10 +6,36 @@ import { currentCliVersion } from "../src/update-notifier.ts";
import {
addWorkspaceApp,
insertWorkspaceApp,
resolveWorkspaceConfig,
workspaceFiles,
workspaceMigrationTargets,
} from "../src/workspace.ts";
test("workspace environments preserve runtime and HMR policy", () => {
const resolved = resolveWorkspaceConfig(
{
environments: {
staging: {
protocol: "https",
rootDomain: "staging.example.com",
port: 443,
runtime: "development",
hmr: false,
build: false,
migrate: false,
profile: "uat",
},
},
apps: [{ name: "web", dir: "apps/web", subdomain: "www" }],
},
"staging",
);
expect(resolved.config.runtime).toBe("development");
expect(resolved.config.hmr).toBe(false);
expect(resolved.config.profile).toBe("uat");
expect(resolved.apps[0]?.publicOrigin).toBe("https://www.staging.example.com");
});
test("workspace templates pin the running framework release", () => {
const files = workspaceFiles("acme");
const rootPackage = JSON.parse(files["package.json"]!);
@@ -21,6 +47,8 @@ test("workspace templates pin the running framework release", () => {
expect(files["README.md"]).toContain("http://127.0.0.1:3000");
expect(files["README.md"]).toContain("internal gateway targets");
expect(JSON.parse(files["package.json"]!).scripts.production).toBe("wrnexus production");
expect(files["wrnexus.workspace.ts"]).toContain('runtime: "development"');
expect(files["wrnexus.workspace.ts"]).toContain("hmr: false");
});
test("production workspace detects default and named SQL migrations", () => {