fix: declare devtools dependencies and enforce strict workspace check… · TanStack/query@9567367 · GitHub
Skip to content

Commit 9567367

Browse files
authored
fix: declare devtools dependencies and enforce strict workspace checks (#11501)
1 parent 12027ef commit 9567367

10 files changed

Lines changed: 139 additions & 40 deletions

File tree

Lines changed: 8 additions & 0 deletions

‎knip.json‎

Lines changed: 0 additions & 28 deletions
This file was deleted.

‎knip.ts‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import angularQuery from './packages/angular-query-experimental/package.json'
2+
import type { KnipConfig } from 'knip'
3+
4+
export default {
5+
ignore: ['scripts/*.{j,t}s', '**/ts-fixture/file.ts'],
6+
treatConfigHintsAsErrors: true,
7+
treatTagHintsAsErrors: true,
8+
ignoreDependencies: ['@types/react', '@types/react-dom'],
9+
ignoreWorkspaces: ['examples/**', 'integrations/**'],
10+
workspaces: {
11+
'.': {
12+
ignoreDependencies: ['react', 'react-dom'],
13+
},
14+
'packages/angular-query-experimental': {
15+
entry: [
16+
'src/devtools/production/index.ts!',
17+
'src/devtools-panel/production/index.ts!',
18+
],
19+
// Strict mode excludes optional dependencies. Read the declared names
20+
// so removing a declaration still causes an unlisted dependency error.
21+
ignoreDependencies: Object.keys(
22+
angularQuery.optionalDependencies ?? {},
23+
).map((dependency) => `${dependency}!`),
24+
},
25+
'packages/query-codemods': {
26+
entry: ['src/v4/**/*.cjs', 'src/v5/**/*.cjs'],
27+
ignore: ['**/__testfixtures__/**'],
28+
},
29+
'packages/vue-query': {
30+
ignoreDependencies: ['vue2', 'vue2.7'],
31+
},
32+
},
33+
} satisfies KnipConfig

‎nx.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
},
3737
"test:knip": {
3838
"cache": true,
39+
"dependsOn": [
40+
{
41+
"target": "build",
42+
"projects": ["directory:packages/*"]
43+
}
44+
],
3945
"inputs": ["{workspaceRoot}/**/*"]
4046
},
4147
"test:sherif": {

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"test:lib:dev": "pnpm run test:lib && nx watch --all -- pnpm run test:lib",
2323
"test:build": "nx affected --target=test:build --exclude=examples/**",
2424
"test:types": "nx affected --target=test:types --exclude=examples/**",
25-
"test:knip": "knip",
25+
"test:knip": "knip && knip --strict --include unlisted --no-gitignore",
2626
"test:docs": "node scripts/verify-links.ts",
2727
"build": "nx affected --target=build --exclude=examples/** --exclude=integrations/**",
2828
"build:all": "nx run-many --target=build --exclude=examples/** --exclude=integrations/**",

‎packages/query-devtools/package.json‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,22 @@
6060
"src",
6161
"!src/__tests__"
6262
],
63-
"devDependencies": {
63+
"dependencies": {
6464
"@kobalte/core": "^0.13.4",
6565
"@solid-primitives/keyed": "^1.2.2",
6666
"@solid-primitives/resize-observer": "^2.0.26",
6767
"@solid-primitives/storage": "^1.3.11",
68-
"@solidjs/testing-library": "^0.8.10",
6968
"@tanstack/match-sorter-utils": "^8.19.4",
7069
"@tanstack/query-core": "workspace:*",
7170
"clsx": "^2.1.1",
7271
"goober": "^2.1.16",
73-
"npm-run-all2": "^5.0.0",
7472
"solid-js": "^1.9.7",
7573
"solid-transition-group": "^0.2.3",
76-
"superjson": "^2.2.2",
74+
"superjson": "^2.2.2"
75+
},
76+
"devDependencies": {
77+
"@solidjs/testing-library": "^0.8.10",
78+
"npm-run-all2": "^5.0.0",
7779
"unplugin-solid": "^2.0.0",
7880
"vite-plugin-solid": "^2.11.6"
7981
}

‎packages/query-devtools/tsdown.config.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ const baseConfig = {
3636
format: ['esm', 'cjs'] as ['esm', 'cjs'],
3737
outDir: 'build',
3838
fixedExtension: false,
39+
// Published source needs these dependencies declared, but the compiled
40+
// devtools must still bundle them with the Solid browser runtime.
41+
deps: {
42+
alwaysBundle: [/./],
43+
dts: { alwaysBundle: [] },
44+
},
3945
inputOptions: {
4046
// Keep package imports in declaration output. Runtime Solid imports are
4147
// bundled from the browser files by solidBrowserImports above.

‎packages/query-test-utils/package.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,8 @@
3737
"type": "module",
3838
"devDependencies": {
3939
"npm-run-all2": "^5.0.0"
40+
},
41+
"peerDependencies": {
42+
"vitest": "^4.0.18"
4043
}
4144
}

‎packages/react-query-devtools/package.json‎

Lines changed: 1 addition & 0 deletions

‎pnpm-lock.yaml‎

Lines changed: 75 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)