Skip to content

chore: replace TypeScript compiler API with jscodeshift in generateVersionedExports - #2676

Merged
joyenjoyer merged 2 commits into
masterfrom
INSTUI-5144-swap-ts-6-compiler-api-to-jscodeshift-in-codemods
Aug 12, 2026
Merged

chore: replace TypeScript compiler API with jscodeshift in generateVersionedExports#2676
joyenjoyer merged 2 commits into
masterfrom
INSTUI-5144-swap-ts-6-compiler-api-to-jscodeshift-in-codemods

Conversation

@joyenjoyer

Copy link
Copy Markdown
Contributor

Summary

  • Replace TypeScript compiler API with jscodeshift for parsing versioned exports
  • Removes dependency on ts.ScriptTarget, ts.isExportDeclaration, ts.isNamedExports
  • Generates byte-identical output; jscodeshift is stable across TypeScript versions
  • Preparation for TypeScript 7 upgrade (TS 7 breaks compiler API surface)

Test Plan

  • Verify node scripts/generateVersionedExports.ts produces identical versionedExports.ts output
  • Run pnpm run bootstrap to confirm codemod generation works in the full build pipeline

Fixes INSTUI-5144

🤖 Generated with Claude Code

…rsionedExports

- Rewrite parseVersionedComponents() to use jscodeshift AST parsing
- Removes hard dependency on ts.ScriptTarget, ts.isExportDeclaration, etc.
- Generates byte-identical output; preparation for TypeScript 7 upgrade
- TS 7.0+ changes compiler API surface incompatibly; jscodeshift is stable across versions

INSTUI-5144
@joyenjoyer joyenjoyer self-assigned this Aug 4, 2026
@joyenjoyer
joyenjoyer requested a review from HerrTopi August 4, 2026 14:55
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-12 12:52 UTC

github-actions Bot pushed a commit that referenced this pull request Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Visual regression report

⚠️ Changes detected.

Status Count
Unchanged 0
Changed 1
New 96
Removed 32

📊 View full report

Diff images (33)

alert.png — baseline no longer produced

avatar.png — baseline no longer produced

badge.png — baseline no longer produced

billboard.png — baseline no longer produced

breadcrumb.png — baseline no longer produced

button-and-derivatives.png — baseline no longer produced

byline.png — baseline no longer produced

calendar.png — baseline no longer produced

checkbox.png — baseline no longer produced

checkboxgroup.png — baseline no longer produced

colorpicker.png — baseline no longer produced

contextview.png — baseline no longer produced

custom-and-lucide-icons.png — baseline no longer produced

dateinput-dateinput2.png — baseline no longer produced

datetimeinput.png — baseline no longer produced

diff-demo.png — 6324 pixels differ

drilldown.png — baseline no longer produced

filedrop.png — baseline no longer produced

form-errors.png — baseline no longer produced

heading.png — baseline no longer produced

img.png — baseline no longer produced

link.png — baseline no longer produced

menu.png — baseline no longer produced

metric-pill-tag-timeselect-text.png — baseline no longer produced

options.png — baseline no longer produced

pagination.png — baseline no longer produced

progressbar.png — baseline no longer produced

select-simpleselect.png — baseline no longer produced

table.png — baseline no longer produced

tabs.png — baseline no longer produced

tooltip.png — baseline no longer produced

treebrowser.png — baseline no longer produced

view.png — baseline no longer produced

Baselines come from the visual-baselines branch. They refresh on every merge to master.

@HerrTopi HerrTopi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Checked the test plan, looks good, but I think I need a bit more context. I'll ask about this later, meanwhile I'll assign the next reviewer

@HerrTopi
HerrTopi requested a review from ToMESSKa August 7, 2026 00:30
// Extract exported names
if (node.specifiers && node.specifiers.length > 0) {
node.specifiers.forEach((spec: any) => {
if (spec.local && spec.local.name) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

 it('rewrites an import that @instructure/ui re-exports under an alias', () => {
    runInlineTest(
      updateInstUIImportVersions,
      { versionTo: 'v11.7' },
      makeFileInfo(`import { TreeBrowserCollection } from '@instructure/ui'`),
      `import { TreeBrowserCollection } from '@instructure/ui/v11_7'`
    )
  })

If you add this test to packages/ui-codemods/lib/__node_tests__/updateInstUIImportVersions.test.ts, it fails. In packages/ui/src/v11_7.ts, TopNavBarItemChild, TreeBrowserCollection and TreeBrowserCollectionData are aliased. Claude suggests usingspec.exported && spec.exported.name instead of spec.local. Worth checking out.

@joyenjoyer
joyenjoyer requested a review from ToMESSKa August 12, 2026 12:33
github-actions Bot pushed a commit that referenced this pull request Aug 12, 2026
@joyenjoyer
joyenjoyer merged commit d1dc807 into master Aug 12, 2026
9 of 11 checks passed
@joyenjoyer
joyenjoyer deleted the INSTUI-5144-swap-ts-6-compiler-api-to-jscodeshift-in-codemods branch August 12, 2026 12:51
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.

3 participants