Skip to content

Commit

Permalink
chore: composite monorepo (#8560)
Browse files Browse the repository at this point in the history
* chore: query-query, react-query and persist-core to composite setup

* fix: self contain packages by having shared configs as symlinks

* fix: add tsConfigPaths to vite config

so that tests can pick up the path aliases

* chore: set outDir, rootDir and baseUrl for all packages

* chore: make legacy tsconfig extend regular tsconfig

* fix: tsc --build

* feat: setup project references

* fix: legacy configs also need references

* fix: oops

* fix: tsup related builds

we need to turn off composite builds for tsup

* fix: set rootDir for tsup builds

so that it can include all files it needs

* fix: remove dependencies on ^build

we no longer need builds to run tests / type checks

* fix: add separate out dir for tsc

* fix: include root eslint config in globals

* refactor: create compile task to depend on

* fix: typo

* fix: dynamic alisases for vitest

* chore: try to fix knip

* fix: make compile a cacheable task

* chore: temporary disable tests against older TS versions

* fix: ts doesn't like string return types

* fix(vue-query-devtools): fix build

* fix: test types

* Revert "chore: temporary disable tests against older TS versions"

This reverts commit 10ef560.

* fix: make legacy ts builds output to their own directory

* chore: remove test:types from examples as they need a build step

* chore: fix knip

* chore: remove test:types from all examples

* Revert "Revert "chore: temporary disable tests against older TS versions""

This reverts commit d6daded.

* fix: outputs for compile task

* chore: remove test:types from integrations

* Revert "Revert "Revert "chore: temporary disable tests against older TS versions"""

This reverts commit 79b4844.

---------

Co-authored-by: Damian Osipiuk <[email protected]>
  • Loading branch information
TkDodo and DamianOsipiuk authored Jan 27, 2025
1 parent d595e23 commit 97f5544
Show file tree
Hide file tree
Showing 200 changed files with 852 additions and 336 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ yarn.lock
build
coverage
dist
dist-ts

# misc
.DS_Store
Expand Down
3 changes: 1 addition & 2 deletions examples/react/algolia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"test:types": "tsc"
"preview": "vite preview"
},
"dependencies": {
"@algolia/client-search": "5.2.1",
Expand Down
3 changes: 1 addition & 2 deletions examples/react/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"test:types": "tsc"
"preview": "vite preview"
},
"dependencies": {
"@tanstack/query-sync-storage-persister": "^5.64.2",
Expand Down
3 changes: 1 addition & 2 deletions examples/react/nextjs-app-prefetching/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"test:types": "tsc"
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.64.2",
Expand Down
3 changes: 1 addition & 2 deletions examples/react/nextjs-suspense-streaming/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"test:types": "tsc"
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.64.2",
Expand Down
3 changes: 1 addition & 2 deletions examples/react/optimistic-updates-cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start",
"test:types": "tsc"
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.64.2",
Expand Down
3 changes: 1 addition & 2 deletions examples/react/react-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"test:types": "tsc"
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.64.2",
Expand Down
3 changes: 1 addition & 2 deletions examples/react/shadow-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"test:types": "tsc"
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.64.2",
Expand Down
3 changes: 1 addition & 2 deletions examples/solid/basic-graphql-request/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"test:types": "tsc"
"preview": "vite preview"
},
"dependencies": {
"@tanstack/solid-query": "^5.64.2",
Expand Down
3 changes: 1 addition & 2 deletions examples/solid/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"test:types": "tsc"
"preview": "vite preview"
},
"dependencies": {
"@tanstack/solid-query": "^5.64.2",
Expand Down
3 changes: 1 addition & 2 deletions examples/solid/default-query-function/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"test:types": "tsc"
"preview": "vite preview"
},
"dependencies": {
"@tanstack/solid-query": "^5.64.2",
Expand Down
3 changes: 1 addition & 2 deletions examples/solid/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"test:types": "tsc"
"preview": "vite preview"
},
"dependencies": {
"@tanstack/solid-query": "^5.64.2",
Expand Down
3 changes: 1 addition & 2 deletions examples/svelte/auto-refetching/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test:types": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
"preview": "vite preview"
},
"dependencies": {
"@tanstack/svelte-query": "^5.64.2",
Expand Down
3 changes: 1 addition & 2 deletions examples/svelte/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test:types": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
"preview": "vite preview"
},
"dependencies": {
"@tanstack/query-sync-storage-persister": "^5.64.2",
Expand Down
3 changes: 1 addition & 2 deletions examples/svelte/load-more-infinite-scroll/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test:types": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
"preview": "vite preview"
},
"dependencies": {
"@tanstack/svelte-query": "^5.64.2",
Expand Down
3 changes: 1 addition & 2 deletions examples/svelte/optimistic-updates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test:types": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
"preview": "vite preview"
},
"dependencies": {
"@tanstack/svelte-query": "^5.64.2",
Expand Down
3 changes: 1 addition & 2 deletions examples/svelte/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test:types": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
"preview": "vite preview"
},
"dependencies": {
"@tanstack/svelte-query": "^5.64.2",
Expand Down
3 changes: 1 addition & 2 deletions examples/svelte/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"test:types": "svelte-check --tsconfig ./tsconfig.json"
"preview": "vite preview"
},
"dependencies": {
"@tanstack/svelte-query": "^5.64.2",
Expand Down
3 changes: 1 addition & 2 deletions examples/svelte/ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test:types": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
"preview": "vite preview"
},
"dependencies": {
"@tanstack/svelte-query": "^5.64.2",
Expand Down
3 changes: 1 addition & 2 deletions examples/svelte/star-wars/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test:types": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
"preview": "vite preview"
},
"dependencies": {
"@tanstack/svelte-query": "^5.64.2",
Expand Down
1 change: 0 additions & 1 deletion integrations/vue-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"private": true,
"type": "module",
"scripts": {
"test:types": "vue-tsc",
"build": "vite build"
},
"dependencies": {
Expand Down
3 changes: 2 additions & 1 deletion knip.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"$schema": "https://unpkg.com/knip@5/schema.json",
"ignore": [".pnpmfile.cjs", "scripts/typedoc-remove-prefix.js"],
"ignore": [".pnpmfile.cjs", "scripts/*.js", "**/root.*.config.*"],
"ignoreDependencies": [
"@types/react",
"@types/react-dom",
"esbuild-plugin-file-path-extensions",
"react",
"react-dom"
],
Expand Down
13 changes: 9 additions & 4 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"{workspaceRoot}/.nvmrc",
"{workspaceRoot}/package.json",
"{workspaceRoot}/scripts/getTsupConfig.js",
"{workspaceRoot}/tsconfig.json"
"{workspaceRoot}/tsconfig.json",
"{workspaceRoot}/eslint.config.js"
],
"default": [
"sharedGlobals",
Expand All @@ -23,6 +24,11 @@
]
},
"targetDefaults": {
"compile": {
"cache": true,
"inputs": ["default", "^production"],
"outputs": ["{projectRoot}/dist-ts"]
},
"test:knip": {
"cache": true,
"inputs": ["{workspaceRoot}/**/*"]
Expand All @@ -33,18 +39,17 @@
},
"test:eslint": {
"cache": true,
"dependsOn": ["^build"],
"dependsOn": ["^compile"],
"inputs": ["default", "^production", "{workspaceRoot}/eslint.config.js"]
},
"test:lib": {
"cache": true,
"dependsOn": ["^build"],
"dependsOn": ["^compile"],
"inputs": ["default", "^production"],
"outputs": ["{projectRoot}/coverage"]
},
"test:types": {
"cache": true,
"dependsOn": ["^build"],
"inputs": ["default", "^production"]
},
"build": {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"typescript55": "npm:[email protected]",
"typescript56": "npm:[email protected]",
"vite": "^5.3.5",
"vite-tsconfig-paths": "^5.1.4",
"vitest": "^2.0.4"
},
"pnpm": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check

import pluginJsdoc from 'eslint-plugin-jsdoc'
import rootConfig from '../../eslint.config.js'
import rootConfig from './root.eslint.config.js'

export default [
...rootConfig,
Expand Down
19 changes: 10 additions & 9 deletions packages/angular-query-devtools-experimental/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@
"url": "https://github.com/sponsors/tannerlinsley"
},
"scripts": {
"clean": "premove ./build ./coverage",
"clean": "premove ./build ./coverage ./dist-ts",
"compile": "tsc --build",
"test:eslint": "eslint ./src",
"test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"",
"test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js",
"test:types:ts52": "node ../../node_modules/typescript52/lib/tsc.js",
"test:types:ts53": "node ../../node_modules/typescript53/lib/tsc.js",
"test:types:ts54": "node ../../node_modules/typescript54/lib/tsc.js",
"test:types:ts55": "node ../../node_modules/typescript55/lib/tsc.js",
"test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js",
"test:types:ts57": "tsc",
"test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js --build",
"test:types:ts52": "node ../../node_modules/typescript52/lib/tsc.js --build",
"test:types:ts53": "node ../../node_modules/typescript53/lib/tsc.js --build",
"test:types:ts54": "node ../../node_modules/typescript54/lib/tsc.js --build",
"test:types:ts55": "node ../../node_modules/typescript55/lib/tsc.js --build",
"test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js --build",
"test:types:ts57": "tsc --build",
"test:build": "publint --strict && attw --pack",
"build": "pnpm build:tsup",
"build:tsup": "tsup"
"build:tsup": "tsup --tsconfig tsconfig.prod.json"
},
"type": "module",
"types": "build/index.d.ts",
Expand Down
9 changes: 8 additions & 1 deletion packages/angular-query-devtools-experimental/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist-ts",
"rootDir": ".",
"baseUrl": ".",
"moduleResolution": "Bundler",
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
Expand All @@ -9,5 +12,9 @@
"target": "ES2022",
"types": ["vitest/globals"]
},
"include": ["src", "eslint.config.js", "vite.config.ts"]
"include": ["src", "*.config.js", "*.config.ts", "package.json"],
"references": [
{ "path": "../query-devtools" },
{ "path": "../angular-query-experimental" }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"incremental": false,
"composite": false,
"rootDir": "../../"
}
}
7 changes: 7 additions & 0 deletions packages/angular-query-devtools-experimental/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { defineConfig } from 'vitest/config'
import tsconfigPaths from 'vite-tsconfig-paths'

import { dynamicAliases } from './root.vite.config'
import packageJson from './package.json'

export default defineConfig({
plugins: [tsconfigPaths({ ignoreConfigErrors: true })],
resolve: {
alias: dynamicAliases,
},
test: {
name: packageJson.name,
dir: './src',
Expand Down
2 changes: 1 addition & 1 deletion packages/angular-query-experimental/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check

import pluginJsdoc from 'eslint-plugin-jsdoc'
import rootConfig from '../../eslint.config.js'
import rootConfig from './root.eslint.config.js'

export default [
...rootConfig,
Expand Down
Loading

0 comments on commit 97f5544

Please sign in to comment.