Skip to content

Move collections to own packages#252

Merged
KyleAMathews merged 16 commits intomainfrom
own-db-collections
Jul 14, 2025
Merged

Move collections to own packages#252
KyleAMathews merged 16 commits intomainfrom
own-db-collections

Conversation

@KyleAMathews
Copy link
Copy Markdown
Collaborator

@KyleAMathews KyleAMathews commented Jul 10, 2025

Summary

  • Move local-only and local-storage collections to main @tanstack/db package
  • Create new @tanstack/electric-db-collection package for Electric SQL integration
  • Create new @tanstack/query-db-collection package for TanStack Query integration
  • Delete @tanstack/db-collections package (removed from repo)
  • Update example app and documentation to use new package structure

Benefits

Package Names Review

@reviewers: Please weigh in on the new package names:

  • @tanstack/electric-db-collection
  • @tanstack/query-db-collection

Are these names clear and intuitive? Any suggestions for improvements?

NPM Deprecation

After merge & release, run this command to deprecate the old package:

npm deprecate @tanstack/db-collections "This package has been split into @tanstack/db (for local collections), @tanstack/electric-db-collection, and @tanstack/query-db-collection"

Test plan

  • All existing tests pass for moved collections in main @tanstack/db package
  • Example app updated and working with new imports
  • Documentation updated in main README
  • New packages have proper exports and structure

🤖 Generated with Claude Code

KyleAMathews and others added 2 commits July 10, 2025 10:22
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Move local-only and local-storage collections to main @tanstack/db package
- Create new @tanstack/db-electric-collection package for Electric SQL integration
- Create new @tanstack/db-query-collection package for TanStack Query integration
- Delete @tanstack/db-collections package (to be deprecated on npm separately)
- Update example app and documentation to use new package structure

This reorganization provides better separation of concerns and allows each collection type to have independent versioning and dependencies.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jul 10, 2025

🦋 Changeset detected

Latest commit: cf110f0

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Jul 10, 2025

@tanstack/db-example-react-todo

@tanstack/db

npm i https://pkg.pr.new/@tanstack/db@252

@tanstack/electric-db-collection

npm i https://pkg.pr.new/@tanstack/electric-db-collection@252

@tanstack/query-db-collection

npm i https://pkg.pr.new/@tanstack/query-db-collection@252

@tanstack/react-db

npm i https://pkg.pr.new/@tanstack/react-db@252

@tanstack/vue-db

npm i https://pkg.pr.new/@tanstack/vue-db@252

commit: f0a4ff0

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jul 10, 2025

Size Change: +2.93 kB (+9.3%) 🔍

Total Size: 34.4 kB

Filename Size Change
./packages/db/dist/esm/index.js 568 B +40 B (+7.58%) 🔍
./packages/db/dist/esm/local-only.js 815 B +815 B (new file) 🆕
./packages/db/dist/esm/local-storage.js 2.07 kB +2.07 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
./packages/db/dist/esm/collection.js 8.27 kB
./packages/db/dist/esm/deferred.js 230 B
./packages/db/dist/esm/errors.js 150 B
./packages/db/dist/esm/optimistic-action.js 294 B
./packages/db/dist/esm/proxy.js 3.75 kB
./packages/db/dist/esm/query/builder/functions.js 531 B
./packages/db/dist/esm/query/builder/index.js 3.4 kB
./packages/db/dist/esm/query/builder/ref-proxy.js 842 B
./packages/db/dist/esm/query/compiler/evaluators.js 1.34 kB
./packages/db/dist/esm/query/compiler/group-by.js 2.09 kB
./packages/db/dist/esm/query/compiler/index.js 1.42 kB
./packages/db/dist/esm/query/compiler/joins.js 1.15 kB
./packages/db/dist/esm/query/compiler/order-by.js 933 B
./packages/db/dist/esm/query/compiler/select.js 657 B
./packages/db/dist/esm/query/ir.js 318 B
./packages/db/dist/esm/query/live-query-collection.js 2.06 kB
./packages/db/dist/esm/SortedMap.js 1.24 kB
./packages/db/dist/esm/transactions.js 2.29 kB

compressed-size-action::db-package-size

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jul 10, 2025

Size Change: 0 B

Total Size: 1.05 kB

ℹ️ View Unchanged
Filename Size
./packages/react-db/dist/esm/index.js 152 B
./packages/react-db/dist/esm/useLiveQuery.js 902 B

compressed-size-action::react-db-package-size

The type tests were importing from @tanstack/db but we're now inside that package,
so we need to use relative imports to ../src/types instead.
@samwillis samwillis self-requested a review July 14, 2025 13:22
Copy link
Copy Markdown
Collaborator

@samwillis samwillis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

My only hesitation is on package names. It would be nice is the collection packages had a common prefix so that they sorted/grouped together:

@tanstack/db-collection-electric
@tanstack/db-collection-query

but that doesn't quite read as well.

@KyleAMathews
Copy link
Copy Markdown
Collaborator Author

KyleAMathews commented Jul 14, 2025

We chatted offline and decided to change the names to follow the general tanstack pattern of specific-integration dash type-of-thing e.g. react-db or react-query — electric dash db-collection follows that same pattern.

@KyleAMathews KyleAMathews merged commit 8e23322 into main Jul 14, 2025
5 checks passed
@KyleAMathews KyleAMathews deleted the own-db-collections branch July 14, 2025 17:30
This was referenced Jul 14, 2025
@github-actions github-actions bot mentioned this pull request Jul 14, 2025
cursor bot pushed a commit that referenced this pull request Jul 16, 2025
Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants