fix: correct feature-report prose, restore update test coverage, warn on sub-0.8.0 upgrades
- generate-complete-framework-report.mjs no longer claims legacyEmit/ legacyEventProps/legacyComponentDiscovery/stringLayouts/ functions.legacyDefaultRuntime are usable compatibility flags; they were removed before the first public release and a config setting them is now rejected. Regenerated docs/WRNEXUS-COMPLETE-FEATURE-REPORT.md. - Restored the update.test.ts coverage lost in the sub-0.8.0 migration cleanup: a 0.8.x fixture now asserts refreshFrameworkFiles' still-live behaviour (public/llms.txt and CLAUDE.md creation) and that pkg.wrnexus.version stays at its old value after an unverified update. The .gitignore refresh and build/start/production script backfill were themselves removed as part of dropping the sub-0.8.0 migrations that implemented them, so there is nothing left to cover for those two. - updateApp now logs a clear warning when the detected project version is below 0.8.0, naming the version and stating that automated migration from below 0.8.0 is no longer supported, without failing the command (a marker-less app, like examples/basic-app, is benign and must still upgrade cleanly). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -950,6 +950,12 @@ export function updateApp(
|
||||
const pkg = JSON.parse(readFileSync(pkgPath, "utf8")) as Record<string, unknown>;
|
||||
const from = appVersion(appRoot, pkg);
|
||||
const log = (m: string) => console.log(` ${m}`);
|
||||
if (cmp(from, "0.8.0") < 0) {
|
||||
log(
|
||||
`⚠ detected version ${from}: automated migration from below 0.8.0 is no longer supported. ` +
|
||||
`Only 0.8.x+ migrations will run; review the project manually before relying on this update.`,
|
||||
);
|
||||
}
|
||||
const report =
|
||||
options.report ??
|
||||
({
|
||||
|
||||
@@ -111,6 +111,33 @@ test("update verification still blocks real doctor errors", () => {
|
||||
).toEqual([fatal]);
|
||||
});
|
||||
|
||||
test("updateApp refreshes framework-owned files without marking an unverified update complete", () => {
|
||||
const root = mkdtempSync(join(tmpdir(), "wrnexus-update-unverified-"));
|
||||
mkdirSync(join(root, "app", "pages"), { recursive: true });
|
||||
writeFileSync(
|
||||
join(root, "package.json"),
|
||||
JSON.stringify({
|
||||
name: "current-app",
|
||||
dependencies: { "@wrnexus/core": "0.8.5" },
|
||||
wrnexus: { version: "0.8.5" },
|
||||
}),
|
||||
);
|
||||
|
||||
try {
|
||||
const result = updateApp(root, "0.8.6", false);
|
||||
expect(result).not.toBeNull();
|
||||
const pkg = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
||||
expect(pkg.dependencies["@wrnexus/core"]).toBe("^0.8.6");
|
||||
// updateApp only bumps dependency versions; the `wrnexus.version` marker is
|
||||
// set later, once install/build/doctor verification actually succeeds.
|
||||
expect(pkg.wrnexus.version).toBe("0.8.5");
|
||||
expect(readFileSync(join(root, "public", "llms.txt"), "utf8")).toContain("# WrNexus");
|
||||
expect(readFileSync(join(root, "CLAUDE.md"), "utf8").length).toBeGreaterThan(0);
|
||||
} finally {
|
||||
rmSync(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("0.8 migration modernizes every WRN source with imports and a review report", () => {
|
||||
const root = mkdtempSync(join(tmpdir(), "wrnexus-update-current-source-"));
|
||||
mkdirSync(join(root, "app", "components"), { recursive: true });
|
||||
@@ -163,3 +190,53 @@ test("0.8 migration modernizes every WRN source with imports and a review report
|
||||
rmSync(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("updateApp warns when a marker-less project is below 0.8.0, and stays quiet at 0.8.x", () => {
|
||||
const belowRoot = mkdtempSync(join(tmpdir(), "wrnexus-update-below-"));
|
||||
const currentRoot = mkdtempSync(join(tmpdir(), "wrnexus-update-current-"));
|
||||
try {
|
||||
// No `wrnexus.version` marker and no installed @wrnexus/cli resolves to
|
||||
// "0.0.0" — the common, benign case (e.g. examples/basic-app).
|
||||
writeFileSync(
|
||||
join(belowRoot, "package.json"),
|
||||
JSON.stringify({ name: "marker-less-app", dependencies: {} }),
|
||||
);
|
||||
writeFileSync(
|
||||
join(currentRoot, "package.json"),
|
||||
JSON.stringify({
|
||||
name: "current-app",
|
||||
dependencies: { "@wrnexus/core": "^0.8.5" },
|
||||
wrnexus: { version: "0.8.5" },
|
||||
}),
|
||||
);
|
||||
|
||||
const originalLog = console.log;
|
||||
const capture = (): string[] => {
|
||||
const logs: string[] = [];
|
||||
console.log = (...args: unknown[]) => {
|
||||
logs.push(args.join(" "));
|
||||
};
|
||||
return logs;
|
||||
};
|
||||
|
||||
let belowLogs: string[];
|
||||
let currentLogs: string[];
|
||||
try {
|
||||
belowLogs = capture();
|
||||
updateApp(belowRoot, "0.8.9", true);
|
||||
|
||||
currentLogs = capture();
|
||||
updateApp(currentRoot, "0.8.9", true);
|
||||
} finally {
|
||||
console.log = originalLog;
|
||||
}
|
||||
|
||||
expect(belowLogs.some((l) => l.includes("no longer supported") && l.includes("0.0.0"))).toBe(
|
||||
true,
|
||||
);
|
||||
expect(currentLogs.some((l) => l.includes("no longer supported"))).toBe(false);
|
||||
} finally {
|
||||
rmSync(belowRoot, { recursive: true, force: true });
|
||||
rmSync(currentRoot, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user