Repository navigation
refactor: use @jssg/utils for common codemod transformations - #187
Merged
schultzp2020 merged 1 commit intoNov 3, 2026
Merged
Conversation
Replace hand-rolled import manipulation (add/remove/rename/resolve,
binding resolution, reference renaming, indent detection) in 41 codemod
scripts across nine recipe packages with the shared helpers from
@jssg/utils/javascript/{imports,bindings,style}, standardizing every
recipe on ^0.0.11. Behavior-preserving: all fixture suites, metrics, and
workflow goldens pass; the only fixture diffs are formatting-only.
Logic with no util equivalent stays hand-rolled (in-place import moves
with re-exports, collision-aware rename orchestration, single-specifier
expansion, namespace member renames). CONTRIBUTING gains a 'Prefer
shared codemod utils' section.
Also fixes the pre-existing v1.54 typed-extension fixture type-check
(the packages it imports are now declared devDependencies) and a latent
node lookup bug in the mui4 styles codemod. Carries a type-only yarn
patch for two TS7 assertion failures in @jssg/utils 0.0.11's raw .ts
source, to be dropped once upstream ships compiled declarations.
schultzp2020
deleted the
kanban/refactor-the-codemods-to-use-jssg-utils-ff7626
branch
November 4, 2026 15:18
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
Every common AST transformation the codemods hand-rolled — import add/remove/rename/resolve, import binding resolution, reference renaming, indent detection — now uses the shared helpers from
@jssg/utils(javascript/imports, plus the newjavascript/bindingsandjavascript/stylemodules), with all recipe packages standardized on^0.0.11.move-connections-backend-imports), collision-aware rename orchestration (rename-connections-public-api— it does adoptrenameReferencesfor the reference rewrite), single-specifier expansion (migrate-collapsible-to-accordion), mid-line indent math (migrate-policy-query-user), and namespace member renames (rename-header-to-plugin-header)..yarn/patches/, registered inpackage.jsonresolutions.patchedDependencies) for two TS7 assertion failures in@jssg/utils@0.0.11's raw.tssource; documented in CONTRIBUTING alongside a new "Prefer shared codemod utils" section (check the utils first, bump deps for new helpers, bespoke logic only with justification).typed-extensionfixture type-check was broken onmain(it imports@backstage/frontend-plugin-apiandzod, which were never declared — now devDependencies of that recipe), and a latent wrong-node lookup in the mui4 styles codemod (uncovered by the new util types, not hit by goldens).Evidence
main(verified by stashing the branch changes and re-running).yarn test— exit 0, 92 jssg fixture suites plus all workflow golden andnode --testsuites;yarn lintandyarn format:check— clean; the four v1.55 fixturetscstages pass with the patch applied. 8expected.tsxfixtures updated, each formatting-only and individually reviewed: the utils remove an import statement together with its trailing newline (the old code left a blank line) and append merged specifiers in source order instead of re-sorting them.Merge Danger
Door: two-way.
Blast Radius: codemod internals only — no workflow, manifest, or public API changes; output differences are limited to the formatting-only fixture diffs above. Publishing is covered by a changeset (patch bumps for the ten affected recipes).
How to test changes / Special notes for the reviewer
yarn test && yarn lint && yarn format:check. Suggested review order: the five exemplar scripts incodemods/misc/mui4-to-bui-migration-recipe/scripts/(button, avatar, skeleton, alert, chip) establish the pattern — the rest are mechanical applications of it; thenCONTRIBUTING.md, the changeset, and the two-line patch file. Reviewer focus worth spending: the fixture diffs undertests/*/merge-existing-bui/and the partially-migrated scripts listed above.