Skip to content

fix(lit-query): migrate to standard tsup build so 'build' output is cached by nx and 'test:build' passes#10943

Open
sukvvon wants to merge 3 commits into
mainfrom
fix/lit-query-standard-tsup-build
Open

fix(lit-query): migrate to standard tsup build so 'build' output is cached by nx and 'test:build' passes#10943
sukvvon wants to merge 3 commits into
mainfrom
fix/lit-query-standard-tsup-build

Conversation

@sukvvon

@sukvvon sukvvon commented Jun 14, 2026

Copy link
Copy Markdown
Member

🎯 Changes

lit-query was the only package building with a non-standard tsc two-pass setup (dist/ ESM + dist-cjs/ CJS via build:cjs + write-cjs-package.mjs). Its dist-cjs/ output is not part of nx's build.outputs ({projectRoot}/build, {projectRoot}/dist), so on a CI cache-hit dist-cjs/ is not restored and publint --strict fails with dist-cjs/index.js does not exist, breaking @tanstack/lit-query:test:build.

This migrates lit-query to the standard tsup build used by the other adapters (react-query as the reference), producing a single build/ directory (build/modern + build/legacy, each with .js/.cjs/.d.ts/.d.cts). build/ is already in nx's build.outputs, so the cache-hit failure is resolved without touching nx.json. While here, the rest of the package config is aligned with react-query for consistency.

Build migration:

  • Add tsup.config.ts and tsconfig.prod.json, and add root.tsup.config.js as a symlink to the shared scripts/getTsupConfig.js (matching every other adapter).
  • Standardize tsconfig.json to extend the root config (drop the per-package NodeNext override).
  • Update package.json: buildtsup --tsconfig tsconfig.prod.json, point main/module/types/exports/files at build/, drop the test:build cjs-smoke step.
  • Remove the now-obsolete tsconfig.build.json, tsconfig.build.cjs.json, scripts/write-cjs-package.mjs, scripts/check-cjs-types-smoke.mjs.
  • Point eslint.config.js ignores and the perf scripts at build/, and drop the stale dist-cjs entry from .gitignore.

Config alignment with react-query:

  • Reorder package.json fields (scripts block first, then type/types/main/module/exports/sideEffects/files/deps).
  • Normalize scripts: clean also removes ./dist-ts, compiletsc --build, test:typestsc --noEmit, test:eslint/lint:fix use --concurrency=auto, test:libvitest, test:lib:devpnpm run test:lib --watch. lit-specific scripts (measure:bundle*, perf:l3*, test:watch) are kept.
  • Rename vitest.config.tsvite.config.ts and add test.name plus the standard istanbul coverage block (enabled on CI).
  • Drop the now-obsolete packages/lit-query src/tests ignore from the root knip.json (the renamed vite.config.ts lets knip detect the test entry automatically, like the other adapters).

Runtime output is unchanged: the named exports are identical (52), attw passes on node10/node16 (CJS/ESM)/bundler, and publint --strict reports All good!.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Chores
    • Migrated build system to standard tsup configuration for improved caching and build efficiency.
    • Reorganized package entrypoints and internal build output structure.
    • Simplified development tooling and TypeScript configurations.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 18d42193-2e04-4a63-9f34-70c2d8b5fcfb

📥 Commits

Reviewing files that changed from the base of the PR and between 47e539a and 59b3169.

📒 Files selected for processing (16)
  • .changeset/lit-query-standard-tsup-build.md
  • .gitignore
  • knip.json
  • packages/lit-query/eslint.config.js
  • packages/lit-query/package.json
  • packages/lit-query/root.tsup.config.js
  • packages/lit-query/scripts/check-cjs-types-smoke.mjs
  • packages/lit-query/scripts/l3-stress.mjs
  • packages/lit-query/scripts/measure-bundle.mjs
  • packages/lit-query/scripts/write-cjs-package.mjs
  • packages/lit-query/tsconfig.build.cjs.json
  • packages/lit-query/tsconfig.build.json
  • packages/lit-query/tsconfig.json
  • packages/lit-query/tsconfig.prod.json
  • packages/lit-query/tsup.config.ts
  • packages/lit-query/vite.config.ts
💤 Files with no reviewable changes (6)
  • packages/lit-query/tsconfig.build.cjs.json
  • packages/lit-query/tsconfig.build.json
  • packages/lit-query/scripts/check-cjs-types-smoke.mjs
  • knip.json
  • .gitignore
  • packages/lit-query/scripts/write-cjs-package.mjs

📝 Walkthrough

Walkthrough

Migrates @tanstack/lit-query from a custom TypeScript/CJS build pipeline to the standard tsup build system. A new tsup.config.ts with modern and legacy build variants replaces tsconfig.build.json, tsconfig.build.cjs.json, and two bespoke CJS post-processing scripts. Package entrypoints are rerouted from dist/dist-cjs to build/modern/build/legacy. Tooling configs (ESLint, .gitignore, knip.json, Vitest) are updated to match.

Changes

lit-query tsup build migration

Layer / File(s) Summary
tsup and TypeScript build configs
packages/lit-query/tsup.config.ts, packages/lit-query/root.tsup.config.js, packages/lit-query/tsconfig.prod.json, packages/lit-query/tsconfig.json, packages/lit-query/tsconfig.build.json, packages/lit-query/tsconfig.build.cjs.json
Adds tsup.config.ts exporting modernConfig and legacyConfig variants for src/index.ts, symlinks root.tsup.config.js to the shared ../../scripts/getTsupConfig.js, adds tsconfig.prod.json with non-incremental production settings, and simplifies tsconfig.json to inherit most flags from the base config. Removes the now-superseded tsconfig.build.json and tsconfig.build.cjs.json.
package.json entrypoints, scripts, and published files
packages/lit-query/package.json
Scripts updated to use tsup --tsconfig tsconfig.prod.json for build and tsc --build for compile, with added clean, measure:*, and perf:* entries. Entrypoint fields (types, main, module) and the exports["."] map are rerouted from dist/dist-cjs to build/legacy and build/modern. The exports["."].default field is removed. Published files change from dist, dist-cjs, and src/**/*.ts to build and src (excluding src/tests).
Removal of custom CJS scripts and build path updates
packages/lit-query/scripts/write-cjs-package.mjs, packages/lit-query/scripts/check-cjs-types-smoke.mjs, packages/lit-query/scripts/l3-stress.mjs, packages/lit-query/scripts/measure-bundle.mjs
Deletes write-cjs-package.mjs (manual .d.ts rewriting to create dist-cjs) and check-cjs-types-smoke.mjs (pack-and-install CJS type validation fixture), both superseded by tsup's native output. Updates l3-stress.mjs and measure-bundle.mjs import/path references from dist to build/modern.
Tooling alignment
packages/lit-query/eslint.config.js, .gitignore, knip.json, packages/lit-query/vite.config.ts, .changeset/lit-query-standard-tsup-build.md
ESLint ignores updated from dist/**/**/dist-cjs/** to **/build/**. dist-cjs removed from .gitignore. knip.json drops the lit-query src/tests/** ignore entry. vite.config.ts adds package.json name as the Vitest project name and makes coverage conditional on process.env.CI. Patch changeset entry added.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • TanStack/query#10776: Updates packages/lit-query/vite.config.ts to make test.coverage.enabled conditional on process.env.CI, the same change applied in this PR.

Suggested reviewers

  • TkDodo

Poem

🐇 Hop, hop, the old dist-cjs is gone,
tsup now builds with a standard song.
build/modern, build/legacy — two new paths clear,
No more hand-stitched scripts to engineer!
The cache can hum, nx smiles with glee,
A cleaner build for all to see. 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: migrating lit-query to standard tsup build to enable nx caching of the build output and fix test:build.
Description check ✅ Passed The PR description is comprehensive and well-structured, covering all required sections including changes, checklist completion, and release impact with a changeset generated.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/lit-query-standard-tsup-build

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

1 package(s) bumped directly, 0 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/lit-query 0.2.7 → 0.2.8 Changeset

@nx-cloud

nx-cloud Bot commented Jun 14, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 0dac11a

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 2m 41s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2026-06-14 13:13:50 UTC

@sukvvon sukvvon self-assigned this Jun 14, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jun 14, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@10943

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@10943

@tanstack/lit-query

npm i https://pkg.pr.new/@tanstack/lit-query@10943

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@10943

@tanstack/preact-query-devtools

npm i https://pkg.pr.new/@tanstack/preact-query-devtools@10943

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@10943

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@10943

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@10943

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@10943

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@10943

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@10943

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@10943

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@10943

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@10943

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@10943

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@10943

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@10943

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@10943

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@10943

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@10943

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@10943

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@10943

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@10943

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@10943

commit: 59b3169

@github-actions

github-actions Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 12.11 KB (0%)
react minimal 9.08 KB (0%)

@sukvvon sukvvon force-pushed the fix/lit-query-standard-tsup-build branch from 22891f4 to 703f2f7 Compare June 14, 2026 11:10
@sukvvon sukvvon force-pushed the fix/lit-query-standard-tsup-build branch from 703f2f7 to 5dae012 Compare June 14, 2026 11:28
…to 'vite.config.ts' to match react-query, drop obsolete knip 'src/tests' ignore
@sukvvon sukvvon force-pushed the fix/lit-query-standard-tsup-build branch from 0dac11a to f8f010c Compare June 14, 2026 13:02
@sukvvon sukvvon marked this pull request as ready for review June 14, 2026 13:14
@sukvvon sukvvon requested a review from a team as a code owner June 14, 2026 13:14
@sukvvon sukvvon requested a review from TkDodo June 14, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant