feat: restore gateway HMR and add WRN formatting
This commit is contained in:
@@ -51,7 +51,9 @@ mobile/.expo/
|
||||
|
||||
# Editors and operating systems
|
||||
.idea/
|
||||
.vscode/
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/extensions.json
|
||||
*.swp
|
||||
*.swo
|
||||
.DS_Store
|
||||
@@ -132,7 +134,14 @@ const tsconfigRootDir = dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
export default tseslint.config(
|
||||
{
|
||||
ignores: ["node_modules/**", "dist/**", ".wrnexus/**", "**/.wrnexus/**", "mobile/android/**", "mobile/ios/**"],
|
||||
ignores: [
|
||||
"node_modules/**",
|
||||
"dist/**",
|
||||
".wrnexus/**",
|
||||
"**/.wrnexus/**",
|
||||
"mobile/android/**",
|
||||
"mobile/ios/**",
|
||||
],
|
||||
},
|
||||
{
|
||||
languageOptions: {
|
||||
@@ -187,6 +196,23 @@ indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
`,
|
||||
".vscode/settings.json": `{
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": "explicit"
|
||||
},
|
||||
"prettier.requireConfig": true,
|
||||
"[wrn]": {
|
||||
"editor.defaultFormatter": "wrnexus.wrnexus",
|
||||
"editor.formatOnSave": true
|
||||
}
|
||||
}
|
||||
`,
|
||||
".vscode/extensions.json": `{
|
||||
"recommendations": ["wrnexus.wrnexus", "esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
|
||||
}
|
||||
`,
|
||||
"wrnexus.config.ts": `import type { AppConfig } from "@wrnexus/styles";
|
||||
|
||||
@@ -274,7 +300,13 @@ Allow: /
|
||||
@custom-variant dark (&:where([data-theme="dark"], [data-theme="dark"] *));
|
||||
|
||||
body {
|
||||
font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
||||
font-family:
|
||||
ui-sans-serif,
|
||||
system-ui,
|
||||
-apple-system,
|
||||
"Segoe UI",
|
||||
Roboto,
|
||||
sans-serif;
|
||||
}
|
||||
`,
|
||||
"app/pages/index.wrn": `// Home page (route: /). SSR-first: the view is server-rendered, then components
|
||||
|
||||
@@ -172,6 +172,87 @@ const MIGRATIONS: Migration[] = [
|
||||
if (!ctx.dryRun) writeFileSync(file, JSON.stringify(pkg, null, 2) + "\n", "utf8");
|
||||
},
|
||||
},
|
||||
{
|
||||
version: "0.2.19",
|
||||
id: "vscode-formatting",
|
||||
description: "Add safe VS Code format-on-save defaults and extension recommendations",
|
||||
apply(ctx) {
|
||||
const vscode = join(ctx.appRoot, ".vscode");
|
||||
const settings = join(vscode, "settings.json");
|
||||
const extensions = join(vscode, "extensions.json");
|
||||
const prettierIgnore = join(ctx.appRoot, ".prettierignore");
|
||||
const gitignore = join(ctx.appRoot, ".gitignore");
|
||||
|
||||
const files: Array<[string, string, string]> = [
|
||||
[
|
||||
settings,
|
||||
JSON.stringify(
|
||||
{
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit" },
|
||||
"prettier.requireConfig": true,
|
||||
"[wrn]": {
|
||||
"editor.defaultFormatter": "wrnexus.wrnexus",
|
||||
"editor.formatOnSave": true,
|
||||
},
|
||||
},
|
||||
null,
|
||||
2,
|
||||
) + "\n",
|
||||
".vscode/settings.json",
|
||||
],
|
||||
[
|
||||
extensions,
|
||||
JSON.stringify(
|
||||
{
|
||||
recommendations: [
|
||||
"wrnexus.wrnexus",
|
||||
"esbenp.prettier-vscode",
|
||||
"dbaeumer.vscode-eslint",
|
||||
],
|
||||
},
|
||||
null,
|
||||
2,
|
||||
) + "\n",
|
||||
".vscode/extensions.json",
|
||||
],
|
||||
];
|
||||
|
||||
for (const [file, contents, label] of files) {
|
||||
if (existsSync(file)) continue;
|
||||
ctx.log(`+ ${label}`);
|
||||
if (!ctx.dryRun) {
|
||||
mkdirSync(vscode, { recursive: true });
|
||||
writeFileSync(file, contents, "utf8");
|
||||
}
|
||||
}
|
||||
|
||||
const prettier = existsSync(prettierIgnore) ? readFileSync(prettierIgnore, "utf8") : "";
|
||||
if (!new Set(prettier.split(/\r?\n/).map((line) => line.trim())).has("CLAUDE.md")) {
|
||||
ctx.log("+ .prettierignore: CLAUDE.md");
|
||||
if (!ctx.dryRun) {
|
||||
writeFileSync(prettierIgnore, `${prettier.replace(/\s*$/, "")}\nCLAUDE.md\n`, "utf8");
|
||||
}
|
||||
}
|
||||
|
||||
if (existsSync(gitignore)) {
|
||||
const current = readFileSync(gitignore, "utf8");
|
||||
const lines = current.split(/\r?\n/);
|
||||
const vscodeIgnore = lines.findIndex((line) => line.trim() === ".vscode/");
|
||||
const needed = [".vscode/*", "!.vscode/settings.json", "!.vscode/extensions.json"];
|
||||
if (vscodeIgnore >= 0 || needed.some((entry) => !lines.includes(entry))) {
|
||||
ctx.log("~ .gitignore: track shared VS Code configuration");
|
||||
if (!ctx.dryRun) {
|
||||
const filtered = lines.filter((line) => line.trim() !== ".vscode/");
|
||||
const have = new Set(filtered.map((line) => line.trim()));
|
||||
for (const entry of needed) if (!have.has(entry)) filtered.push(entry);
|
||||
writeFileSync(gitignore, filtered.join("\n").replace(/\n*$/, "\n"), "utf8");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
/** Release tooling uses this to require an explicit migration entry per version. */
|
||||
@@ -246,6 +327,9 @@ function backupProjectFiles(appRoot: string, from: string, target: string): stri
|
||||
"wrnexus.config.mjs",
|
||||
"tsconfig.json",
|
||||
".gitignore",
|
||||
".prettierignore",
|
||||
".vscode/settings.json",
|
||||
".vscode/extensions.json",
|
||||
"CLAUDE.md",
|
||||
"public/llms.txt",
|
||||
]) {
|
||||
|
||||
Reference in New Issue
Block a user