fix: normalize generated VS Code configuration

This commit is contained in:
2026-07-13 15:02:19 +05:30
parent cff420a29e
commit cf4c3723c5
54 changed files with 142 additions and 99 deletions
+26 -15
View File
@@ -72,6 +72,20 @@ interface Migration {
apply: (ctx: MigrationCtx) => void;
}
const VSCODE_EXTENSIONS = `{
"recommendations": ["wrnexus.wrnexus", "esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
}
`;
const LEGACY_VSCODE_EXTENSIONS =
JSON.stringify(
{
recommendations: ["wrnexus.wrnexus", "esbenp.prettier-vscode", "dbaeumer.vscode-eslint"],
},
null,
2,
) + "\n";
/**
* Versioned, idempotent upgrade steps. Each MUST be safe to re-run and MUST NOT
* overwrite user code. Append new entries with the version that ships them.
@@ -202,21 +216,7 @@ const MIGRATIONS: Migration[] = [
) + "\n",
".vscode/settings.json",
],
[
extensions,
JSON.stringify(
{
recommendations: [
"wrnexus.wrnexus",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
],
},
null,
2,
) + "\n",
".vscode/extensions.json",
],
[extensions, VSCODE_EXTENSIONS, ".vscode/extensions.json"],
];
for (const [file, contents, label] of files) {
@@ -253,6 +253,17 @@ const MIGRATIONS: Migration[] = [
}
},
},
{
version: "0.2.20",
id: "normalize-vscode-extensions",
description: "Normalize the framework-generated VS Code recommendations file",
apply(ctx) {
const file = join(ctx.appRoot, ".vscode", "extensions.json");
if (!existsSync(file) || readFileSync(file, "utf8") !== LEGACY_VSCODE_EXTENSIONS) return;
ctx.log("~ .vscode/extensions.json formatting normalized");
if (!ctx.dryRun) writeFileSync(file, VSCODE_EXTENSIONS, "utf8");
},
},
];
/** Release tooling uses this to require an explicit migration entry per version. */