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 4 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 4 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 the package build to a standardized tsup setup to improve build caching and overall build reliability.
    • Updated published package outputs and entrypoints to use the new build artifacts.
    • Streamlined TypeScript and tooling configuration to better align with the new build flow.
  • Bug Fixes
    • Fixed build/test inconsistencies so test:build is more likely to pass after clean builds.
  • Documentation
    • Added/update release metadata for the @tanstack/lit-query patch bump.

@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: 091c491e-d8d0-4863-b477-5f9fb8f725f4

📥 Commits

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

📒 Files selected for processing (2)
  • knip.json
  • packages/lit-query/package.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/lit-query/package.json
  • knip.json

📝 Walkthrough

Walkthrough

Migrates @tanstack/lit-query to tsup-based build/modern and build/legacy outputs, updates package metadata and scripts to match, removes custom CJS helper scripts, and aligns ESLint, Knip, Vitest, .gitignore, and the changeset entry with the new build layout.

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
Adds the tsup config with modern and legacy build variants for src/index.ts, points root.tsup.config.js at the shared tsup helper, introduces a production TypeScript config, and trims the package TypeScript config to inherit most compiler settings from the base config.
package.json entrypoints, scripts, and published files
packages/lit-query/package.json
Reworks scripts to use tsup and tsc --build, switches types/main/module and the exports["."] map from dist* to build/legacy and build/modern, removes the internal default export mapping, and changes the published files list to build plus src with tests excluded.
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 the custom CJS packaging and type-smoke scripts, and updates the remaining build-adjacent scripts to read from build/modern instead of dist.
Tooling alignment
packages/lit-query/eslint.config.js, .gitignore, knip.json, packages/lit-query/vite.config.ts, .changeset/lit-query-standard-tsup-build.md
Adjusts lint ignores for build, stops ignoring dist-cjs, updates Knip workspace entries, changes Vitest coverage and project naming, and adds the patch changeset entry.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • TanStack/query#10776: Changes packages/lit-query/vite.config.ts coverage handling in the same way, making test.coverage.enabled conditional on process.env.CI.
  • TanStack/query#10995: Also touches build-output accounting around lit-query and dist-cjs/build artifacts.

Suggested reviewers

  • TkDodo
  • schiller-manuel

Poem

🐇 Hop went the build from old to new,
dist-cjs packed its bags and flew.
tsup now hums through build/modern light,
While build/legacy keeps exports right.
A rabbit claps with twitchy nose—
Cleaner paths and fewer woes.

🚥 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 clearly summarizes the main change: migrating lit-query to the standard tsup build for Nx cacheability and test:build stability.
Description check ✅ Passed The description matches the required template sections and includes the checklist and release impact details, with a changeset noted.
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.
✨ Finishing Touches
🧪 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.

@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.9 → 0.2.10 Changeset

@nx-cloud

nx-cloud Bot commented Jun 14, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit edc4b75

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

☁️ Nx Cloud last updated this comment at 2026-06-28 09:50: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: edc4b75

@github-actions

github-actions Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 12.13 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