feat(cli): v0.1.3 codemod migrating layout.components to experimental.xle.components#3290
Open
ejhammond wants to merge 1 commit into
Open
Conversation
….xle.components
The published 0.1.2 CLI read XLE app-component registration from
astryx.config.* under layout.components. The next release relocates this
to experimental.xle.components, validated by a strict schema that rejects
unknown keys, so consumers with layout.components would hard-error on
upgrade. This adds a v0.1.3 config codemod that performs the straight
relocation.
Semantics are identical between the old and new shapes; this is purely a
move plus a string to object normalization:
- string 'X' becomes { from: 'X' } (named import, key = export name)
- object { from, description?, default? } is carried over unchanged
The transform recognizes the default export as either a bare object
literal or a createConfig({ ... }) wrapper, and bails with a clear
migrate-manually error when the config cannot be statically analyzed,
when experimental.xle already exists, when layout has keys other than
components, or when an entry is neither a string nor an object literal.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
The published
0.1.2CLI read XLE app-component registration fromastryx.config.*underlayout.components. The integration branch relocated this toexperimental.xle.components, validated by a strict schema that rejects unknown keys — so any consumer that still haslayout.componentsin their config will hard-error on upgrade.This PR adds a v0.1.3 config codemod (
migrate-layout-components-to-experimental) that performs the relocation automatically.Semantics are identical (this is a straight move + normalization)
The old and new entry shapes mean the same thing; nothing about import semantics changes:
'X'→{ from: 'X' }— a named import where the key is both the local name and the export name.{ from, description?, default? }→ carried over unchanged (preservingfrom/description/defaultand key order).default: true= default import; otherwise named.Behavior
The transform operates on the config's default export and handles both:
export default { ... }createConfig({ ... })wrapper:export default createConfig({ ... })It builds
experimental.xle.componentsfromlayout.components, places it (creatingexperimental/experimental.xleas needed), and removes the now-emptylayoutproperty.It bails with a clear migrate-manually error (thrown, surfaced by
runConfigCodemod's try/catch as a structured{file, codemod, error}) when:experimental.xlealready exists (can't safely merge)layouthas keys other thancomponents(the only documented key)Returns
null(no change) when there's nolayout.components, including already-migrated configs (idempotence).Wiring
packages/cli/src/codemods/transforms/v0.1.3/.0.1.3in the codemod registry (after0.1.2).meta.codemodType = 'config'and a(file, api) => string | null | undefinedtransform, routed throughrunConfigCodemod.Testing
npx vitest run packages/cli→ 1602 passed (98 files), including 20 new transform tests (string/object entries, multiple entries, both wrapper forms, placement into existingexperimental, no-op/idempotence, and all bail cases) plus two end-to-end-ish tests driving the transform throughrunConfigCodemod.node scripts/sync-exports.js --check→ 0./scripts/add-copyright.sh --check→ 0pnpm -F @astryxdesign/cli typecheck:json-api→ 0pnpm build+node scripts/verify-exports.mjs→ 0npx eslinton changed files → 0node scripts/check-changesets.mjs→ 0astryx upgrade --list --jsonincludesmigrate-layout-components-to-experimentalat version0.1.3.