From 50030d2d6fa3901fe0718da17e9a27c1a958ccac Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Sun, 4 Jun 2023 09:15:48 +1000 Subject: [PATCH 1/4] Make publint throw errors --- packages/eslint-plugin-query/package.json | 2 +- packages/query-async-storage-persister/package.json | 2 +- packages/query-broadcast-client-experimental/package.json | 2 +- packages/query-core/package.json | 2 +- packages/query-devtools/package.json | 2 +- packages/query-persist-client-core/package.json | 2 +- packages/query-sync-storage-persister/package.json | 2 +- packages/react-query-devtools/package.json | 2 +- packages/react-query-persist-client/package.json | 2 +- packages/react-query/package.json | 2 +- packages/solid-query/package.json | 2 +- packages/svelte-query-devtools/package.json | 2 +- packages/svelte-query/package.json | 2 +- packages/vue-query/package.json | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/eslint-plugin-query/package.json b/packages/eslint-plugin-query/package.json index c825f2b4b65..e54bb7ada2b 100644 --- a/packages/eslint-plugin-query/package.json +++ b/packages/eslint-plugin-query/package.json @@ -30,7 +30,7 @@ "test:types": "tsc --noEmit", "test:lib": "vitest run --coverage", "test:lib:dev": "pnpm run test:lib --watch", - "test:build": "publint", + "test:build": "publint --strict", "build": "tsup --minify --dts" }, "files": [ diff --git a/packages/query-async-storage-persister/package.json b/packages/query-async-storage-persister/package.json index d81ec84f3cc..2ed50db7cad 100644 --- a/packages/query-async-storage-persister/package.json +++ b/packages/query-async-storage-persister/package.json @@ -34,7 +34,7 @@ "test:types": "tsc --noEmit", "test:lib": "vitest run --coverage", "test:lib:dev": "pnpm run test:lib --watch", - "test:build": "publint", + "test:build": "publint --strict", "build": "pnpm build:rollup && pnpm build:types", "build:rollup": "rollup --config rollup.config.js", "build:types": "tsc --emitDeclarationOnly" diff --git a/packages/query-broadcast-client-experimental/package.json b/packages/query-broadcast-client-experimental/package.json index f7a478f1205..9519bc8f2b5 100644 --- a/packages/query-broadcast-client-experimental/package.json +++ b/packages/query-broadcast-client-experimental/package.json @@ -32,7 +32,7 @@ "clean": "rimraf ./build && rimraf ./coverage", "test:eslint": "eslint --ext .ts,.tsx ./src", "test:types": "tsc --noEmit", - "test:build": "publint", + "test:build": "publint --strict", "build": "pnpm build:rollup && pnpm build:types", "build:rollup": "rollup --config rollup.config.js", "build:types": "tsc --emitDeclarationOnly" diff --git a/packages/query-core/package.json b/packages/query-core/package.json index 85befc2c3dd..3db268f065e 100644 --- a/packages/query-core/package.json +++ b/packages/query-core/package.json @@ -34,7 +34,7 @@ "test:types": "tsc --noEmit", "test:lib": "vitest run --coverage", "test:lib:dev": "pnpm run test:lib --watch", - "test:build": "publint", + "test:build": "publint --strict", "build": "pnpm build:rollup && pnpm build:types", "build:rollup": "rollup --config rollup.config.js", "build:types": "tsc --emitDeclarationOnly" diff --git a/packages/query-devtools/package.json b/packages/query-devtools/package.json index 7b7697b3502..b5408aa8853 100644 --- a/packages/query-devtools/package.json +++ b/packages/query-devtools/package.json @@ -34,7 +34,7 @@ "test:types": "tsc --noEmit", "test:lib": "vitest run --coverage", "test:lib:dev": "pnpm run test:lib --watch", - "test:build": "publint", + "test:build": "publint --strict", "build": "pnpm build:rollup && pnpm rename-build-dir", "rename-build-dir": "rimraf ./build && mv ./dist ./build", "build:rollup": "rollup --config rollup.config.js", diff --git a/packages/query-persist-client-core/package.json b/packages/query-persist-client-core/package.json index 0605e654704..10b7c6a4a89 100644 --- a/packages/query-persist-client-core/package.json +++ b/packages/query-persist-client-core/package.json @@ -34,7 +34,7 @@ "test:types": "tsc --noEmit", "test:lib": "vitest run --coverage", "test:lib:dev": "pnpm run test:lib --watch", - "test:build": "publint", + "test:build": "publint --strict", "build": "pnpm build:rollup && pnpm build:types", "build:rollup": "rollup --config rollup.config.js", "build:types": "tsc --emitDeclarationOnly" diff --git a/packages/query-sync-storage-persister/package.json b/packages/query-sync-storage-persister/package.json index ed1ac3d03c7..0005cd6e590 100644 --- a/packages/query-sync-storage-persister/package.json +++ b/packages/query-sync-storage-persister/package.json @@ -34,7 +34,7 @@ "test:types": "tsc --noEmit", "test:lib": "vitest run --coverage", "test:lib:dev": "pnpm run test:lib --watch", - "test:build": "publint", + "test:build": "publint --strict", "build": "pnpm build:rollup && pnpm build:types", "build:rollup": "rollup --config rollup.config.js", "build:types": "tsc --emitDeclarationOnly" diff --git a/packages/react-query-devtools/package.json b/packages/react-query-devtools/package.json index a232ca461b1..5f1e394d586 100644 --- a/packages/react-query-devtools/package.json +++ b/packages/react-query-devtools/package.json @@ -40,7 +40,7 @@ "test:types": "tsc --noEmit", "test:lib": "vitest run --coverage", "test:lib:dev": "pnpm run test:lib --watch", - "test:build": "publint", + "test:build": "publint --strict", "build": "pnpm build:rollup && pnpm build:types", "build:rollup": "rollup --config rollup.config.js", "build:types": "tsc --emitDeclarationOnly && cpy index.d.ts index.prod.d.ts --cwd=build/lib" diff --git a/packages/react-query-persist-client/package.json b/packages/react-query-persist-client/package.json index 143f0c53630..52a4a0e56c0 100644 --- a/packages/react-query-persist-client/package.json +++ b/packages/react-query-persist-client/package.json @@ -34,7 +34,7 @@ "test:types": "tsc --noEmit", "test:lib": "vitest run --coverage", "test:lib:dev": "pnpm run test:lib --watch", - "test:build": "publint", + "test:build": "publint --strict", "build": "pnpm build:rollup && pnpm build:types", "build:rollup": "rollup --config rollup.config.js", "build:types": "tsc --emitDeclarationOnly" diff --git a/packages/react-query/package.json b/packages/react-query/package.json index 82190fc0873..0c56669f967 100644 --- a/packages/react-query/package.json +++ b/packages/react-query/package.json @@ -30,7 +30,7 @@ "test:types": "tsc --noEmit", "test:lib": "vitest run --coverage", "test:lib:dev": "pnpm run test:lib --watch", - "test:build": "publint", + "test:build": "publint --strict", "build": "pnpm build:rollup && pnpm build:codemods && pnpm build:types", "build:rollup": "rollup --config rollup.config.js", "build:codemods": "cpy ../codemods/src/**/* ./build/codemods", diff --git a/packages/solid-query/package.json b/packages/solid-query/package.json index f4775add4a9..4d0cf701994 100644 --- a/packages/solid-query/package.json +++ b/packages/solid-query/package.json @@ -33,7 +33,7 @@ "test:types": "tsc --noEmit", "test:lib": "vitest run --coverage", "test:lib:dev": "pnpm run test:lib --watch", - "test:build": "publint", + "test:build": "publint --strict", "build": "pnpm build:rollup && pnpm build:types", "build:rollup": "rollup --config rollup.config.js", "build:types": "tsc --emitDeclarationOnly" diff --git a/packages/svelte-query-devtools/package.json b/packages/svelte-query-devtools/package.json index b365dd6b0df..578af66c6b1 100644 --- a/packages/svelte-query-devtools/package.json +++ b/packages/svelte-query-devtools/package.json @@ -31,7 +31,7 @@ "clean": "rimraf ./build && rimraf ./coverage", "test:types": "svelte-check --tsconfig ./tsconfig.json", "test:eslint": "eslint --ext .svelte,.ts ./src", - "test:build": "publint", + "test:build": "publint --strict", "build": "svelte-package --input ./src --output ./build/lib" }, "dependencies": { diff --git a/packages/svelte-query/package.json b/packages/svelte-query/package.json index 8f7cb2f1f94..988f22b491d 100644 --- a/packages/svelte-query/package.json +++ b/packages/svelte-query/package.json @@ -35,7 +35,7 @@ "test:eslint": "eslint --ext .svelte,.ts ./src", "test:lib": "vitest run --coverage", "test:lib:dev": "pnpm run test:lib --watch", - "test:build": "publint", + "test:build": "publint --strict", "build": "svelte-package --input ./src --output ./build/lib" }, "dependencies": { diff --git a/packages/vue-query/package.json b/packages/vue-query/package.json index 1ff09a56422..f6083f5774c 100644 --- a/packages/vue-query/package.json +++ b/packages/vue-query/package.json @@ -37,7 +37,7 @@ "test:2.7": "vue-demi-switch 2.7 vue2.7 && vitest", "test:3": "vue-demi-switch 3 && vitest", "test:lib:dev": "pnpm run test:lib --watch", - "test:build": "publint", + "test:build": "publint --strict", "build": "pnpm build:rollup && pnpm build:types", "build:rollup": "rollup --config rollup.config.js", "build:types": "tsc --emitDeclarationOnly" From 0538047b33141a2efcae2e15677d04ebd6a36d7c Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Sun, 4 Jun 2023 09:44:31 +1000 Subject: [PATCH 2/4] Rewrite CJS files to use .cjs extension --- packages/query-devtools/package.json | 28 ++++++++++----------- packages/query-devtools/rollup.config.js | 31 ++++++++++++++++++------ 2 files changed, 37 insertions(+), 22 deletions(-) diff --git a/packages/query-devtools/package.json b/packages/query-devtools/package.json index b5408aa8853..5e060399b68 100644 --- a/packages/query-devtools/package.json +++ b/packages/query-devtools/package.json @@ -11,20 +11,20 @@ "url": "https://github.com/sponsors/tannerlinsley" }, "type": "module", - "types": "build/types/index.d.ts", - "main": "build/cjs/index.js", - "module": "build/esm/index.js", + "types": "dist/types/index.d.ts", + "main": "dist/cjs/index.js", + "module": "dist/esm/index.js", "exports": { ".": { - "types": "./build/types/index.d.ts", - "solid": "./build/source/index.jsx", - "import": "./build/esm/index.js", + "types": "./dist/types/index.d.ts", + "solid": "./dist/source/index.jsx", + "import": "./dist/esm/index.js", "browser": { - "import": "./build/esm/index.js", - "require": "./build/cjs/index.js" + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js" }, - "require": "./build/cjs/index.js", - "node": "./build/cjs/index.js" + "require": "./dist/cjs/index.js", + "node": "./dist/cjs/index.js" }, "./package.json": "./package.json" }, @@ -35,13 +35,11 @@ "test:lib": "vitest run --coverage", "test:lib:dev": "pnpm run test:lib --watch", "test:build": "publint --strict", - "build": "pnpm build:rollup && pnpm rename-build-dir", - "rename-build-dir": "rimraf ./build && mv ./dist ./build", - "build:rollup": "rollup --config rollup.config.js", - "build:types": "tsc --emitDeclarationOnly" + "build": "pnpm build:rollup", + "build:rollup": "rollup --config rollup.config.js" }, "files": [ - "build", + "dist", "src" ], "dependencies": { diff --git a/packages/query-devtools/rollup.config.js b/packages/query-devtools/rollup.config.js index 540dc9e36fd..e188340430e 100644 --- a/packages/query-devtools/rollup.config.js +++ b/packages/query-devtools/rollup.config.js @@ -1,13 +1,30 @@ // @ts-check + +import { defineConfig } from 'rollup' import withSolid from 'rollup-preset-solid' -const config = withSolid({ - input: 'src/index.tsx', - targets: ['esm', 'cjs'], -}) +export function createQueryDevtoolsConfig() { + const solidRollupOptions = /** @type {import('rollup').RollupOptions} */ ( + withSolid({ + input: `./src/index.tsx`, + targets: ['esm', 'cjs'], + external: [], + }) + ) + + const outputs = !solidRollupOptions.output + ? [] + : Array.isArray(solidRollupOptions.output) + ? solidRollupOptions.output + : [solidRollupOptions.output] + + outputs.forEach((output) => { + if (output.format === 'cjs') { + output.entryFileNames = '[name].cjs' + } + }) -if (!Array.isArray(config)) { - config.external = [] + return solidRollupOptions } -export default config +export default defineConfig(createQueryDevtoolsConfig()) From 13ab10e09e84282be0df2ca025080938e151dedc Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Sun, 4 Jun 2023 09:44:50 +1000 Subject: [PATCH 3/4] Add concurrency option to PR workflow --- .github/workflows/pr.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 7e74b3ee543..0efc3910ab7 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -2,6 +2,10 @@ name: pr on: [pull_request] +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + env: NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} From e495cb5f03eb7b99831a20319cea25aafdc608c7 Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Sun, 4 Jun 2023 09:49:06 +1000 Subject: [PATCH 4/4] Fix export extensions --- packages/query-devtools/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/query-devtools/package.json b/packages/query-devtools/package.json index 5e060399b68..fb9fa2bba2a 100644 --- a/packages/query-devtools/package.json +++ b/packages/query-devtools/package.json @@ -12,7 +12,7 @@ }, "type": "module", "types": "dist/types/index.d.ts", - "main": "dist/cjs/index.js", + "main": "dist/cjs/index.cjs", "module": "dist/esm/index.js", "exports": { ".": { @@ -21,10 +21,10 @@ "import": "./dist/esm/index.js", "browser": { "import": "./dist/esm/index.js", - "require": "./dist/cjs/index.js" + "require": "./dist/cjs/index.cjs" }, - "require": "./dist/cjs/index.js", - "node": "./dist/cjs/index.js" + "require": "./dist/cjs/index.cjs", + "node": "./dist/cjs/index.cjs" }, "./package.json": "./package.json" },