build: enforce complete private release workflow

This commit is contained in:
2026-07-13 14:13:03 +05:30
parent b4e5fade19
commit 1c541f3350
57 changed files with 438 additions and 92 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@wrnexus/cli",
"version": "0.2.17",
"version": "0.2.18",
"type": "module",
"main": "src/index.ts",
"exports": {
+21
View File
@@ -156,8 +156,29 @@ const MIGRATIONS: Migration[] = [
if (!ctx.dryRun) writeFileSync(file, JSON.stringify(pkg, null, 2) + "\n", "utf8");
},
},
{
version: "0.2.18",
id: "add-helpers-package",
description: "Add @wrnexus/helpers to existing runnable applications",
apply(ctx) {
// Workspace roots do not consume application Context helpers directly.
if (!existsSync(join(ctx.appRoot, "app", "pages"))) return;
const file = join(ctx.appRoot, "package.json");
const pkg = JSON.parse(readFileSync(file, "utf8")) as Record<string, any>;
const dependencies = (pkg.dependencies ??= {} as Record<string, string>);
if (dependencies["@wrnexus/helpers"]) return;
dependencies["@wrnexus/helpers"] = `^${ctx.to}`;
ctx.log(`+ @wrnexus/helpers ^${ctx.to}`);
if (!ctx.dryRun) writeFileSync(file, JSON.stringify(pkg, null, 2) + "\n", "utf8");
},
},
];
/** Release tooling uses this to require an explicit migration entry per version. */
export function updateMigrationVersions(): string[] {
return [...new Set(MIGRATIONS.map((migration) => migration.version))];
}
/** Bump every `@wrnexus/*` range to `^target`. Returns the human-readable changes. */
function bumpDeps(pkg: Record<string, unknown>, target: string): string[] {
const changed: string[] = [];
+25
View File
@@ -36,3 +36,28 @@ test("updateApp migrates project files without marking an unverified update comp
rmSync(root, { recursive: true, force: true });
}
});
test("0.2.18 migration adds helpers to existing apps and is idempotent", () => {
const root = mkdtempSync(join(tmpdir(), "wrnexus-update-"));
mkdirSync(join(root, "app", "pages"), { recursive: true });
writeFileSync(
join(root, "package.json"),
JSON.stringify({
name: "existing-app",
dependencies: { "@wrnexus/core": "^0.2.17" },
wrnexus: { version: "0.2.17" },
}),
);
try {
updateApp(root, "0.2.18", false);
updateApp(root, "0.2.18", false);
const pkg = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
expect(pkg.dependencies["@wrnexus/helpers"]).toBe("^0.2.18");
expect(
Object.keys(pkg.dependencies).filter((name) => name === "@wrnexus/helpers"),
).toHaveLength(1);
} finally {
rmSync(root, { recursive: true, force: true });
}
});