From 3f5ec8696f13a82a45f668a3c760f3d6b1385e1b Mon Sep 17 00:00:00 2001 From: Ajay Ghanwat Date: Sun, 9 Aug 2026 20:22:55 +0530 Subject: [PATCH] ignore dev caches in example tool configs --- examples/basic-app/.prettierignore | 2 + examples/basic-app/eslint.config.js | 9 +++- examples/basic-app/tsconfig.json | 3 +- .../inter-app-api-showcase/.prettierignore | 2 + .../inter-app-api-showcase/eslint.config.js | 12 +++++- examples/inter-app-api-showcase/tsconfig.json | 2 +- .../test/cache-ignore-config.test.ts | 42 ++++++++++++++----- 7 files changed, 57 insertions(+), 15 deletions(-) diff --git a/examples/basic-app/.prettierignore b/examples/basic-app/.prettierignore index c803ee57..2dc5e3e8 100644 --- a/examples/basic-app/.prettierignore +++ b/examples/basic-app/.prettierignore @@ -1,6 +1,8 @@ node_modules/ dist/ .wrnexus/ +.wrnexus-*/ +**/.wrnexus-*/ .wirefw/ **/.wirefw/ **/*.gen.ts diff --git a/examples/basic-app/eslint.config.js b/examples/basic-app/eslint.config.js index 10fb4eb5..81d8fe9a 100644 --- a/examples/basic-app/eslint.config.js +++ b/examples/basic-app/eslint.config.js @@ -7,7 +7,14 @@ const tsconfigRootDir = dirname(fileURLToPath(import.meta.url)); export default tseslint.config( { - ignores: ["node_modules/**", "dist/**", ".wrnexus/**", "**/.wrnexus/**"], + ignores: [ + "node_modules/**", + "dist/**", + ".wrnexus/**", + "**/.wrnexus/**", + ".wrnexus-*/**", + "**/.wrnexus-*/**", + ], }, { languageOptions: { diff --git a/examples/basic-app/tsconfig.json b/examples/basic-app/tsconfig.json index 04762e9f..de160be2 100644 --- a/examples/basic-app/tsconfig.json +++ b/examples/basic-app/tsconfig.json @@ -3,5 +3,6 @@ "compilerOptions": { "lib": ["ESNext", "DOM", "DOM.Iterable"] }, - "include": ["app"] + "include": ["app"], + "exclude": ["node_modules", "dist", ".wrnexus-*", "**/.wrnexus-*"] } diff --git a/examples/inter-app-api-showcase/.prettierignore b/examples/inter-app-api-showcase/.prettierignore index b62d22e1..eb0f5158 100644 --- a/examples/inter-app-api-showcase/.prettierignore +++ b/examples/inter-app-api-showcase/.prettierignore @@ -2,5 +2,7 @@ node_modules/ dist/ .wrnexus/ **/.wrnexus/ +.wrnexus-*/ +**/.wrnexus-*/ *.log **/CLAUDE.md diff --git a/examples/inter-app-api-showcase/eslint.config.js b/examples/inter-app-api-showcase/eslint.config.js index 177993d1..79238f0f 100644 --- a/examples/inter-app-api-showcase/eslint.config.js +++ b/examples/inter-app-api-showcase/eslint.config.js @@ -6,7 +6,17 @@ import tseslint from "typescript-eslint"; const tsconfigRootDir = dirname(fileURLToPath(import.meta.url)); export default tseslint.config( - { ignores: ["node_modules/**", "dist/**", "**/dist/**", ".wrnexus/**", "**/.wrnexus/**"] }, + { + ignores: [ + "node_modules/**", + "dist/**", + "**/dist/**", + ".wrnexus/**", + "**/.wrnexus/**", + ".wrnexus-*/**", + "**/.wrnexus-*/**", + ], + }, { languageOptions: { parserOptions: { tsconfigRootDir } } }, js.configs.recommended, ...tseslint.configs.recommended, diff --git a/examples/inter-app-api-showcase/tsconfig.json b/examples/inter-app-api-showcase/tsconfig.json index d4437925..16ceccc2 100644 --- a/examples/inter-app-api-showcase/tsconfig.json +++ b/examples/inter-app-api-showcase/tsconfig.json @@ -11,5 +11,5 @@ "allowImportingTsExtensions": true }, "include": ["wrnexus.workspace.ts", "packages/**/*.ts"], - "exclude": ["node_modules", "dist", "apps"] + "exclude": ["node_modules", "dist", "apps", ".wrnexus-*", "**/.wrnexus-*"] } diff --git a/packages/dev-server/test/cache-ignore-config.test.ts b/packages/dev-server/test/cache-ignore-config.test.ts index 6f41a8d9..67a1317d 100644 --- a/packages/dev-server/test/cache-ignore-config.test.ts +++ b/packages/dev-server/test/cache-ignore-config.test.ts @@ -4,7 +4,7 @@ import { join, resolve } from "node:path"; const root = resolve(import.meta.dir, "../../.."); -test("per-process dev caches are excluded from every repository-wide tool", () => { +test("per-process dev caches are excluded from root and example project tools", () => { const eslint = readFileSync(join(root, "eslint.config.js"), "utf8"); const tsconfig = JSON.parse(readFileSync(join(root, "tsconfig.json"), "utf8")) as { exclude?: string[]; @@ -15,26 +15,46 @@ test("per-process dev caches are excluded from every repository-wide tool", () = expect(tsconfig.exclude).toContain("**/.wrnexus-*"); expect(prettier).toContain("**/.wrnexus-*/**"); - const cache = join(root, "packages", "dev-server", "test", ".tmp-cache-ignore", ".wrnexus-123"); - mkdirSync(cache, { recursive: true }); - writeFileSync(join(cache, "broken.client.mjs"), "const = ;\n", "utf8"); - writeFileSync(join(cache, "broken.d.ts"), "type = ;\n", "utf8"); + const projects = ["basic-app", "inter-app-api-showcase"].map((name) => + join(root, "examples", name), + ); + const caches = projects.map((project) => join(project, ".wrnexus-123")); + + for (const project of projects) { + const projectEslint = readFileSync(join(project, "eslint.config.js"), "utf8"); + const projectTsconfig = JSON.parse(readFileSync(join(project, "tsconfig.json"), "utf8")) as { + exclude?: string[]; + }; + const projectPrettier = readFileSync(join(project, ".prettierignore"), "utf8"); + + expect(projectEslint).toContain('".wrnexus-*/**"'); + expect(projectEslint).toContain('"**/.wrnexus-*/**"'); + expect(projectTsconfig.exclude).toContain(".wrnexus-*"); + expect(projectTsconfig.exclude).toContain("**/.wrnexus-*"); + expect(projectPrettier).toContain(".wrnexus-*/"); + expect(projectPrettier).toContain("**/.wrnexus-*/"); + } + + for (const cache of caches) { + mkdirSync(cache, { recursive: true }); + writeFileSync(join(cache, "broken.client.mjs"), "const = ;\n", "utf8"); + writeFileSync(join(cache, "broken.d.ts"), "type = ;\n", "utf8"); + } try { const lint = Bun.spawnSync( [ "bunx", "eslint", "--no-warn-ignored", - join(cache, "broken.client.mjs"), - join(cache, "broken.d.ts"), + ...caches.flatMap((cache) => [ + join(cache, "broken.client.mjs"), + join(cache, "broken.d.ts"), + ]), ], { cwd: root }, ); expect(lint.exitCode).toBe(0); } finally { - rmSync(join(root, "packages", "dev-server", "test", ".tmp-cache-ignore"), { - recursive: true, - force: true, - }); + for (const cache of caches) rmSync(cache, { recursive: true, force: true }); } });