Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Split rollup config for Nx caching #5487

Merged
merged 8 commits into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
"test:eslint",
"test:types",
"test:build",
"build:types",
"build",
"rollup"
"build:rollup",
"build:codemods",
"build:types"
],
"accessToken": "ZDdkNDA4MGEtYjNmYi00MWI4LWE1N2QtYTdlNmYxMGJlZWM2fHJlYWQ="
}
Expand Down Expand Up @@ -63,13 +64,12 @@
"inputs": ["default", "^public"],
"dependsOn": ["^test:types"]
},
"build:types": {
"build": {
"outputs": [
"{projectRoot}/build/**/*.d.ts",
"{projectRoot}/build/.tsbuildinfo"
"{projectRoot}/build/**/*"
],
"inputs": ["default", "^public"],
"dependsOn": ["^build:types"]
"dependsOn": ["^build"]
},
"test:build": {
"dependsOn": ["build"],
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
"test:lib:dev": "pnpm --filter \"./packages/**\" run test:lib:dev",
"test:build": "nx run-many --target=test:build --projects=root",
"test:types": "nx affected --target=test:types --parallel=5",
"build": "nx run-many --target=build --projects=root",
"build:types": "nx affected --target=build:types --parallel=5",
"watch": "concurrently --kill-others \"rollup --config rollup.config.js -w\" \"pnpm run build:types --watch\"",
"build": "nx run-many --target=build --projects=root --parallel=5",
"watch": "concurrently --kill-others \"pnpm -r build:rollup -w\" \"pnpm -r build:types --watch\"",
"dev": "pnpm run watch",
"prettier": "prettier --plugin-search-dir . \"{packages,examples}/**/src/**/*.{md,js,jsx,cjs,ts,tsx,json,vue,svelte}\"",
"prettier:write": "pnpm run prettier --write",
Expand Down
2 changes: 1 addition & 1 deletion packages/codemods/tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"compilerOptions": {
"noEmit": true
},
"include": ["**/*.ts", "**/*.tsx", "./.eslintrc.cjs"]
"include": ["**/*.ts", "**/*.tsx", ".eslintrc.cjs"]
}
2 changes: 1 addition & 1 deletion packages/eslint-plugin-query/tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"compilerOptions": {
"noEmit": true
},
"include": ["**/*.ts", "**/*.tsx", "./.eslintrc.cjs"]
"include": ["**/*.ts", "**/*.tsx", ".eslintrc.cjs"]
}
2 changes: 2 additions & 0 deletions packages/query-async-storage-persister/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"test:types": "tsc",
"test:lib": "vitest run --coverage",
"test:lib:dev": "pnpm run test:lib --watch",
"build": "pnpm build:rollup && pnpm build:types",
"build:rollup": "rollup --config rollup.config.mjs",
"build:types": "tsc --build"
},
"dependencies": {
Expand Down
17 changes: 17 additions & 0 deletions packages/query-async-storage-persister/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// @ts-check

import { defineConfig } from 'rollup'
import { buildConfigs } from "../../scripts/getRollupConfig.mjs"

export default defineConfig([
...buildConfigs({
name: 'query-async-storage-persister',
packageDir: '.',
jsName: 'QueryAsyncStoragePersister',
outputFile: 'index',
entryFile: 'src/index.ts',
globals: {
'@tanstack/query-persist-client-core': 'QueryPersistClientCore',
},
}),
])
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"compilerOptions": {
"noEmit": true
},
"include": ["**/*.ts", "**/*.tsx", "./.eslintrc.cjs"]
"include": ["**/*.ts", "**/*.tsx", ".eslintrc.cjs", "rollup.config.mjs"]
}
2 changes: 2 additions & 0 deletions packages/query-broadcast-client-experimental/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
"clean": "rimraf ./build",
"test:eslint": "eslint --ext .ts,.tsx ./src",
"test:types": "tsc",
"build": "pnpm build:rollup && pnpm build:types",
"build:rollup": "rollup --config rollup.config.mjs",
"build:types": "tsc --build"
},
"dependencies": {
Expand Down
18 changes: 18 additions & 0 deletions packages/query-broadcast-client-experimental/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// @ts-check

import { defineConfig } from 'rollup'
import { buildConfigs } from "../../scripts/getRollupConfig.mjs"

export default defineConfig([
...buildConfigs({
name: 'query-broadcast-client-experimental',
packageDir: '.',
jsName: 'QueryBroadcastClient',
outputFile: 'index',
entryFile: 'src/index.ts',
globals: {
'@tanstack/query-core': 'QueryCore',
'broadcast-channel': 'BroadcastChannel',
},
}),
])
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"compilerOptions": {
"noEmit": true
},
"include": ["**/*.ts", "**/*.tsx", "./.eslintrc.cjs"]
"include": ["**/*.ts", "**/*.tsx", ".eslintrc.cjs", "rollup.config.mjs"]
}
2 changes: 2 additions & 0 deletions packages/query-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"test:types": "tsc",
"test:lib": "vitest run --coverage",
"test:lib:dev": "pnpm run test:lib --watch",
"build": "pnpm build:rollup && pnpm build:types",
"build:rollup": "rollup --config rollup.config.mjs",
"build:types": "tsc --build"
}
}
15 changes: 15 additions & 0 deletions packages/query-core/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// @ts-check

import { defineConfig } from 'rollup'
import { buildConfigs } from "../../scripts/getRollupConfig.mjs"

export default defineConfig([
...buildConfigs({
name: 'query-core',
packageDir: '.',
jsName: 'QueryCore',
outputFile: 'index',
entryFile: ['src/index.ts'],
globals: {},
}),
])
2 changes: 1 addition & 1 deletion packages/query-core/tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"compilerOptions": {
"noEmit": true
},
"include": ["**/*.ts", "**/*.tsx", "./.eslintrc.cjs"]
"include": ["**/*.ts", "**/*.tsx", ".eslintrc.cjs", "rollup.config.mjs"]
}
2 changes: 2 additions & 0 deletions packages/query-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
"test:types": "tsc",
"test:lib": "vitest run --coverage",
"test:lib:dev": "pnpm run test:lib --watch",
"build": "pnpm build:rollup && pnpm build:types",
"build:rollup": "rollup --config rollup.config.mjs",
"build:types": "tsc --build"
},
"files": [
Expand Down
8 changes: 8 additions & 0 deletions packages/query-devtools/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @ts-check

import { defineConfig } from 'rollup'
import { createTanstackQueryDevtoolsConfig } from "../../scripts/getRollupConfig.mjs"

export default defineConfig([
createTanstackQueryDevtoolsConfig(),
])
2 changes: 1 addition & 1 deletion packages/query-devtools/tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"compilerOptions": {
"noEmit": true
},
"include": ["**/*.ts", "**/*.tsx", "./.eslintrc.cjs"]
"include": ["**/*.ts", "**/*.tsx", ".eslintrc.cjs", "rollup.config.mjs"]
}
2 changes: 2 additions & 0 deletions packages/query-persist-client-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"test:types": "tsc",
"test:lib": "vitest run --coverage",
"test:lib:dev": "pnpm run test:lib --watch",
"build": "pnpm build:rollup && pnpm build:types",
"build:rollup": "rollup --config rollup.config.mjs",
"build:types": "tsc --build"
},
"dependencies": {
Expand Down
17 changes: 17 additions & 0 deletions packages/query-persist-client-core/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// @ts-check

import { defineConfig } from 'rollup'
import { buildConfigs } from "../../scripts/getRollupConfig.mjs"

export default defineConfig([
...buildConfigs({
name: 'query-persist-client-core',
packageDir: '.',
jsName: 'QueryPersistClientCore',
outputFile: 'index',
entryFile: ['src/index.ts'],
globals: {
'@tanstack/query-core': 'QueryCore',
},
}),
])
2 changes: 1 addition & 1 deletion packages/query-persist-client-core/tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"compilerOptions": {
"noEmit": true
},
"include": ["**/*.ts", "**/*.tsx", "./.eslintrc.cjs"]
"include": ["**/*.ts", "**/*.tsx", ".eslintrc.cjs", "rollup.config.mjs"]
}
2 changes: 2 additions & 0 deletions packages/query-sync-storage-persister/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"test:types": "tsc",
"test:lib": "vitest run --coverage",
"test:lib:dev": "pnpm run test:lib --watch",
"build": "pnpm build:rollup && pnpm build:types",
"build:rollup": "rollup --config rollup.config.mjs",
"build:types": "tsc --build"
},
"dependencies": {
Expand Down
17 changes: 17 additions & 0 deletions packages/query-sync-storage-persister/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// @ts-check

import { defineConfig } from 'rollup'
import { buildConfigs } from "../../scripts/getRollupConfig.mjs"

export default defineConfig([
...buildConfigs({
name: 'query-sync-storage-persister',
packageDir: '.',
jsName: 'QuerySyncStoragePersister',
outputFile: 'index',
entryFile: 'src/index.ts',
globals: {
'@tanstack/query-persist-client-core': 'QueryPersistClientCore',
},
}),
])
2 changes: 1 addition & 1 deletion packages/query-sync-storage-persister/tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"compilerOptions": {
"noEmit": true
},
"include": ["**/*.ts", "**/*.tsx", "./.eslintrc.cjs"]
"include": ["**/*.ts", "**/*.tsx", ".eslintrc.cjs", "rollup.config.mjs"]
}
2 changes: 2 additions & 0 deletions packages/react-query-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
"test:types": "tsc",
"test:lib": "vitest run --coverage",
"test:lib:dev": "pnpm run test:lib --watch",
"build": "pnpm build:rollup && pnpm build:types",
"build:rollup": "rollup --config rollup.config.mjs",
"build:types": "tsc --build && cpy build/lib/index.d.ts build/lib/index.prod.d.ts"
},
"devDependencies": {
Expand Down
38 changes: 38 additions & 0 deletions packages/react-query-devtools/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// @ts-check

import { defineConfig } from 'rollup'
import { buildConfigs } from "../../scripts/getRollupConfig.mjs"

export default defineConfig([
...buildConfigs({
name: 'react-query-devtools',
packageDir: '.',
jsName: 'ReactQueryDevtools',
outputFile: 'index',
entryFile: 'src/index.ts',
globals: {
react: 'React',
'react-dom': 'ReactDOM',
'@tanstack/react-query': 'ReactQuery',
'@tanstack/query-devtools': 'TanstackQueryDevtools',
},
bundleUMDGlobals: ['@tanstack/query-devtools'],
}),
...buildConfigs({
name: 'react-query-devtools-prod',
packageDir: '.',
jsName: 'ReactQueryDevtools',
outputFile: 'index.prod',
entryFile: 'src/index.ts',
globals: {
react: 'React',
'react-dom': 'ReactDOM',
'@tanstack/react-query': 'ReactQuery',
'@tanstack/match-sorter-utils': 'MatchSorterUtils',
superjson: 'SuperJson',
},
forceDevEnv: true,
forceBundle: true,
skipUmdBuild: true,
}),
])
2 changes: 1 addition & 1 deletion packages/react-query-devtools/tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"compilerOptions": {
"noEmit": true
},
"include": ["**/*.ts", "**/*.tsx", "./.eslintrc.cjs"]
"include": ["**/*.ts", "**/*.tsx", ".eslintrc.cjs", "rollup.config.mjs"]
}
2 changes: 2 additions & 0 deletions packages/react-query-persist-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"test:types": "tsc",
"test:lib": "vitest run --coverage",
"test:lib:dev": "pnpm run test:lib --watch",
"build": "pnpm build:rollup && pnpm build:types",
"build:rollup": "rollup --config rollup.config.mjs",
"build:types": "tsc --build"
},
"devDependencies": {
Expand Down
20 changes: 20 additions & 0 deletions packages/react-query-persist-client/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// @ts-check

import { defineConfig } from 'rollup'
import { buildConfigs } from "../../scripts/getRollupConfig.mjs"

export default defineConfig([
...buildConfigs({
name: 'react-query-persist-client',
packageDir: '.',
jsName: 'ReactQueryPersistClient',
outputFile: 'index',
entryFile: 'src/index.ts',
globals: {
react: 'React',
'@tanstack/query-persist-client-core': 'QueryPersistClientCore',
'@tanstack/react-query': 'ReactQuery',
},
bundleUMDGlobals: ['@tanstack/query-persist-client-core'],
}),
])
2 changes: 1 addition & 1 deletion packages/react-query-persist-client/tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"compilerOptions": {
"noEmit": true
},
"include": ["**/*.ts", "**/*.tsx", "./.eslintrc.cjs"]
"include": ["**/*.ts", "**/*.tsx", ".eslintrc.cjs", "rollup.config.mjs"]
}
4 changes: 3 additions & 1 deletion packages/react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
"test:types": "tsc",
"test:lib": "vitest run --coverage",
"test:lib:dev": "pnpm run test:lib --watch",
"build": "cpy ../codemods/src/**/* ./build/codemods",
"build": "pnpm build:rollup && pnpm build:codemods && pnpm build:types",
"build:rollup": "rollup --config rollup.config.mjs",
"build:codemods": "cpy ../codemods/src/**/* ./build/codemods",
"build:types": "tsc --build"
},
"files": [
Expand Down
21 changes: 21 additions & 0 deletions packages/react-query/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// @ts-check

import { defineConfig } from 'rollup'
import { buildConfigs } from "../../scripts/getRollupConfig.mjs"

export default defineConfig([
...buildConfigs({
name: 'react-query',
packageDir: '.',
jsName: 'ReactQuery',
outputFile: 'index',
entryFile: ['src/index.ts'],
globals: {
react: 'React',
'react-dom': 'ReactDOM',
'@tanstack/query-core': 'QueryCore',
'react-native': 'ReactNative',
},
bundleUMDGlobals: ['@tanstack/query-core'],
}),
])
2 changes: 1 addition & 1 deletion packages/react-query/tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"compilerOptions": {
"noEmit": true
},
"include": ["**/*.ts", "**/*.tsx", "./.eslintrc.cjs"]
"include": ["**/*.ts", "**/*.tsx", ".eslintrc.cjs", "rollup.config.mjs"]
}
2 changes: 2 additions & 0 deletions packages/solid-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
"test:types": "tsc",
"test:lib": "vitest run --coverage",
"test:lib:dev": "pnpm run test:lib --watch",
"build": "pnpm build:rollup && pnpm build:types",
"build:rollup": "rollup --config rollup.config.mjs",
"build:types": "tsc --build"
},
"files": [
Expand Down
8 changes: 8 additions & 0 deletions packages/solid-query/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @ts-check

import { defineConfig } from 'rollup'
import { createSolidQueryConfig } from "../../scripts/getRollupConfig.mjs"

export default defineConfig([
createSolidQueryConfig(),
])
Loading