release: WRNexusJS 0.2.78
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@wrnexus/cli",
|
||||
"version": "0.2.77",
|
||||
"version": "0.2.78",
|
||||
"type": "module",
|
||||
"main": "src/index.ts",
|
||||
"exports": {
|
||||
|
||||
@@ -767,6 +767,14 @@ const MIGRATIONS: Migration[] = [
|
||||
// Language and shared UI behavior improve automatically after updating.
|
||||
},
|
||||
},
|
||||
{
|
||||
version: "0.2.78",
|
||||
id: "ui-components-fix",
|
||||
description: "Dev toolbar for optimization and developer.",
|
||||
apply() {
|
||||
// Language and shared UI behavior improve automatically after updating.
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
/** Release tooling uses this to require an explicit migration entry per version. */
|
||||
@@ -893,6 +901,20 @@ export function updateApp(appRoot: string, target: string, dryRun: boolean): Upd
|
||||
return { root: appRoot, packagePath: pkgPath, pkg };
|
||||
}
|
||||
|
||||
export function verificationCommands(scripts: Record<string, string>): string[][] {
|
||||
const commands: string[][] = [];
|
||||
|
||||
// Update migrations can rewrite TypeScript, JSON, and framework configuration
|
||||
// files. Normalize those edits with the project's own formatter before running
|
||||
// the read-only format check. This prevents a successful migration from failing
|
||||
// only because wrnexus.config.ts or another touched file needs Prettier output.
|
||||
if (scripts.format) commands.push(["run", "format"]);
|
||||
if (scripts.check) commands.push(["run", "check"]);
|
||||
if (scripts.build) commands.push(["run", "build"]);
|
||||
|
||||
return commands;
|
||||
}
|
||||
|
||||
function verifyApp(app: UpdatedApp): boolean {
|
||||
const health = inspectProject(app.root);
|
||||
const failed = health.filter((check) => !check.ok && check.name !== "configuration");
|
||||
@@ -900,12 +922,11 @@ function verifyApp(app: UpdatedApp): boolean {
|
||||
for (const check of failed) console.error(` ✗ ${check.name}: ${check.detail}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
const scripts = (app.pkg.scripts ?? {}) as Record<string, string>;
|
||||
const commands: string[][] = [];
|
||||
if (scripts.check) commands.push(["run", "check"]);
|
||||
if (scripts.build) commands.push(["run", "build"]);
|
||||
for (const args of commands) {
|
||||
console.log(`\n Verifying ${app.pkg.name ?? app.root}: bun ${args.join(" ")}…`);
|
||||
for (const args of verificationCommands(scripts)) {
|
||||
const action = args[1] === "format" ? "Formatting" : "Verifying";
|
||||
console.log(`\n ${action} ${app.pkg.name ?? app.root}: bun ${args.join(" ")}…`);
|
||||
const result = spawnSync(process.execPath, args, { cwd: app.root, stdio: "inherit" });
|
||||
if (result.status !== 0) return false;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { expect, test } from "bun:test";
|
||||
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { updateApp } from "../src/update.ts";
|
||||
import { updateApp, verificationCommands } from "../src/update.ts";
|
||||
|
||||
test("updateApp migrates project files without marking an unverified update complete", () => {
|
||||
const root = mkdtempSync(join(tmpdir(), "wrnexus-update-"));
|
||||
@@ -150,3 +150,21 @@ test("0.2.20 migration repairs only the legacy generated recommendations layout"
|
||||
rmSync(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("update verification formats before checking and building", () => {
|
||||
expect(
|
||||
verificationCommands({
|
||||
format: "prettier . --write",
|
||||
check: "bun run lint && bun run format:check",
|
||||
build: "wrnexus build .",
|
||||
}),
|
||||
).toEqual([
|
||||
["run", "format"],
|
||||
["run", "check"],
|
||||
["run", "build"],
|
||||
]);
|
||||
});
|
||||
|
||||
test("update verification skips unavailable scripts", () => {
|
||||
expect(verificationCommands({ check: "bun run lint" })).toEqual([["run", "check"]]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user