Repository navigation
feat(core)!: split plugins and app configs into a definition and a runtime - #25
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 6106a12 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
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 |
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Next included review available in 59 minutes. View limit details
TanStack is on CodeRabbit Free, which includes PR summaries. Ask your admin to upgrade for code reviews.
|
cursor
Bot
force-pushed
the
cursor/definition-entry-0c86
branch
from
November 6, 2026 02:57
c76a818 to
e126e12
Compare
cursor
Bot
force-pushed
the
cursor/definition-split-0c86
branch
from
November 6, 2026 02:57
b29aea0 to
d135174
Compare
jherr
force-pushed
the
cursor/definition-entry-0c86
branch
from
November 6, 2026 03:17
e126e12 to
2850c54
Compare
This was referenced Nov 6, 2026
Merged
cursor
Bot
force-pushed
the
cursor/definition-split-0c86
branch
from
November 6, 2026 14:50
d135174 to
ebd385b
Compare
jherr
force-pushed
the
cursor/definition-split-0c86
branch
from
November 6, 2026 15:06
ebd385b to
6106a12
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements cms-refactor-plan.md § Phase 1e(ii) (questions 19b–19d).
Merge chain: step 5 of 24. Base:
main. Merge it right after #24. The branch ismain3b4a112, then one commit for each PR before this one in the merge order, then this PR's own commitebd385b(tree8fa68a5).What
definePlugin({ definition: definePluginDefinition({ name, collections, adminNav, routes, adminRoutes }), runtime: { blockTypes, fieldTypes, ops, eventHandlers, onEvent } }).definePlugin({ name, … })form throws aTypeErrorthat names the codemod./definitionexportsdefinePluginDefinition;definePluginis root-only.defineCms(definition, { collections: { post: { hooks, access, storage } } })attaches them to collections by name. Hooks are typed from that collection's fields.fields), and a hook or rule that the definition already sets.pnpm codemod definition-split [paths], with fixtures.cms.definition.tscontaining the collections,admin, the plugin definitions and their dependencies, importing from/definition.cms.config.tstodefineCms(definition, runtime).Registerat the definition.definePlugincalls.cms.definition.ts.starters/runtime-tablesstays a single file, which 19b allows.app/base: its audit hooks, itspostReadaccess check andreports.readmoved tosrc/collection-runtime.ts, andmodel.tsnow imports only/definition.examples/db-markdown: its storage adapter moved to the runtime config.cms-connect-atprotois now a runtime-only plugin.tanstack-cms initwrites both files.cms.definition.ts.test:definitionsis now--strict, so it blocks. It also scaffolds and checks theinitoutput and a code-mode skill app. All 26 definitions load.docs/api/cms-core.mdcovers runtimecollectionsandplugins.docs/deployment/upgrading.mdhas before/after code for plugins and the definition move..claude/skillsinstructions and theexamples/*-afterdocs are updated..changeset/definition-split.mdnames both breaking changes and gives the codemod command.Breaking changes
definePluginshown above. To migrate, runpnpm codemod definition-split <app>from a TanStack CMS checkout./definitionexportsdefinePluginDefinitionandCmsPluginDefinitioninstead ofdefinePluginandCmsPlugin.collectionsis a name-keyed object of{ hooks, access, storage }. Before this PR the runtime config rejectedcollections.Divergence from plan
storagein runtime collections. Runtime collections also acceptstorage, becausedb-markdown's adapter importsnode:fs.defineInterfaceCollectionnow joins/definition.createRoutes(definition)wiring.Assumptions
minorin alpha pre-mode, following the existing changesets.Registerpoints attypeof definition, soRegisteredOpstyping is lost. No app uses typed ops.cms-migrate-wpand the per-CMS migration guides keep the one-file form, which is allowed.How verified
pnpm test:prpasses except thecms-apioxlint error thatmainalready has.test:dts,test:dialects,test:definitions(strict, 26 of 26),test:scripts(84), kiira andtest:docspass.*-afterparity tests and blog-voting pass.node scripts/pack-consumer.mjsfails only on theformsLeadCaptureSkillerror thatmainalready has.test:dialectsneeded one fix: its retiredcollectionsRecordmarker was narrowed so the 19d runtime shape doesn't count as the old Record form. A test covers it.Merge chain (local verification, CI down)
This PR's commits are squashed into one commit on the linear merge chain. That commit holds this PR's own changes, resolved against every PR before it, with the integration rehearsal's fixes for this PR applied. No conflicts. It was replayed from
e126e12, this PR's copy of #24, whose tree is the same as2850c54's.The chain tip's tree is exactly the integration rehearsal plus #46 (
c4e6d7c), and the tip passes the full local suite. I simulated merging every PR in order, with a merge commit or a fast-forward at each step, and every step is clean. A plain squash of the next PR would conflict, because the squash commit isn't an ancestor of the next branch. To squash instead, first rebase the branch's one commit onto the newmain; that rebase is always clean.