Skip to content

Commit 5dae012

Browse files
committed
fix(lit-query): migrate to standard tsup build so 'build' output is cached by nx and 'test:build' passes
1 parent 43a4ea0 commit 5dae012

14 files changed

Lines changed: 44 additions & 278 deletions
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tanstack/lit-query': patch
3+
---
4+
5+
fix(lit-query): migrate to the standard tsup build so the `build` output is cached by nx and `test:build` passes

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ yarn.lock
1010
build
1111
coverage
1212
dist
13-
dist-cjs
1413
dist-ts
1514

1615
# misc

packages/lit-query/eslint.config.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ import tseslint from 'typescript-eslint'
88
export default tseslint.config(
99
{
1010
ignores: [
11-
'dist/**',
11+
'build/**',
1212
'coverage/**',
1313
'node_modules/**',
1414
'.claude/**',
1515
'.references/**',
16-
'**/dist/**',
17-
'**/dist-cjs/**',
16+
'**/build/**',
1817
'examples/**/output/**',
1918
'**/*.d.ts',
2019
],

packages/lit-query/package.json

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,44 +15,40 @@
1515
"url": "https://github.com/sponsors/tannerlinsley"
1616
},
1717
"type": "module",
18-
"main": "dist-cjs/index.js",
19-
"module": "dist/index.js",
20-
"types": "dist/index.d.ts",
18+
"types": "build/legacy/index.d.ts",
19+
"main": "build/legacy/index.cjs",
20+
"module": "build/legacy/index.js",
2121
"sideEffects": false,
2222
"files": [
23-
"dist",
24-
"dist-cjs",
25-
"src/**/*.ts",
26-
"!src/tests/**/*"
23+
"build",
24+
"src",
25+
"!src/tests"
2726
],
2827
"exports": {
2928
".": {
3029
"@tanstack/custom-condition": "./src/index.ts",
3130
"import": {
32-
"types": "./dist/index.d.ts",
33-
"default": "./dist/index.js"
31+
"types": "./build/modern/index.d.ts",
32+
"default": "./build/modern/index.js"
3433
},
3534
"require": {
36-
"types": "./dist-cjs/index.d.cts",
37-
"default": "./dist-cjs/index.js"
38-
},
39-
"default": "./dist/index.js"
35+
"types": "./build/modern/index.d.cts",
36+
"default": "./build/modern/index.cjs"
37+
}
4038
},
4139
"./package.json": "./package.json"
4240
},
4341
"scripts": {
42+
"clean": "premove ./build ./coverage",
4443
"compile": "node ../../node_modules/typescript/lib/tsc.js --build",
45-
"build:deps": "pnpm --dir ../query-core run build",
46-
"build": "pnpm run build:deps && pnpm run build:esm && pnpm run build:cjs",
47-
"build:esm": "node ../../node_modules/typescript/lib/tsc.js -p tsconfig.build.json",
48-
"build:cjs": "node -e \"require('node:fs').rmSync('dist-cjs', { recursive: true, force: true })\" && node ../../node_modules/typescript/lib/tsc.js -p tsconfig.build.cjs.json && node scripts/write-cjs-package.mjs",
44+
"build": "tsup --tsconfig tsconfig.prod.json",
4945
"test:types": "node ../../node_modules/typescript/lib/tsc.js --noEmit",
5046
"test:eslint": "eslint .",
5147
"lint:fix": "eslint . --fix",
5248
"test:lib": "vitest run",
5349
"test:lib:dev": "vitest",
5450
"test:watch": "pnpm run test:lib:dev",
55-
"test:build": "publint --strict && attw --pack && node scripts/check-cjs-types-smoke.mjs",
51+
"test:build": "publint --strict && attw --pack",
5652
"measure:bundle": "pnpm run build && node scripts/measure-bundle.mjs",
5753
"measure:bundle:raw": "node scripts/measure-bundle.mjs",
5854
"perf:l3": "pnpm run build && node scripts/l3-stress.mjs",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../scripts/getTsupConfig.js

packages/lit-query/scripts/check-cjs-types-smoke.mjs

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

packages/lit-query/scripts/l3-stress.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { QueryClient } from '@tanstack/query-core'
2-
import { createQueryController } from '../dist/index.js'
2+
import { createQueryController } from '../build/modern/index.js'
33

44
class TestControllerHost {
55
controllers = new Set()

packages/lit-query/scripts/measure-bundle.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { fileURLToPath } from 'node:url'
55

66
const scriptDir = path.dirname(fileURLToPath(import.meta.url))
77
const repoRoot = path.resolve(scriptDir, '..')
8-
const distDir = path.join(repoRoot, 'dist')
8+
const distDir = path.join(repoRoot, 'build', 'modern')
99
const entryFile = path.join(distDir, 'index.js')
1010

1111
async function getDirSizeBytes(dirPath) {

packages/lit-query/scripts/write-cjs-package.mjs

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

packages/lit-query/tsconfig.build.cjs.json

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

0 commit comments

Comments
 (0)