chore(codemod): Modernize to ESM + bump all deps + add test suite#418
Open
csandman wants to merge 2 commits into
Open
chore(codemod): Modernize to ESM + bump all deps + add test suite#418csandman wants to merge 2 commits into
csandman wants to merge 2 commits into
Conversation
- Switch `"type": "module"` and update tsconfig to `module: nodenext`
- Rewrite bin/cli.ts: named ESM imports, `createRequire`/`fileURLToPath`
polyfills for CJS globals, typed `RunTransformOptions` interface,
proper `AnyFlags` schema for meow, typed inquirer prompt
- bin/crs-codemod.ts: replace `require("./cli").run()` with ESM import
- Update all deps to current ESM-native majors (execa 9, globby 16,
inquirer 13, jscodeshift 17, meow 14) and devDeps (rimraf 6,
typescript 6, @types/* aligned)
- Add vitest + `test`/`test:watch`/`test:update` scripts
- Add tests/v5.test.ts with fixture-based snapshot tests (5 fixtures
covering basic, aliased imports, all select variants, prop
preservation, and unrelated-library guard)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
oxfmt reformats JSX self-closing tags to put /> on its own line, but jscodeshift produces them inline. Fixture files must exactly reflect the transform output, so adding them to the oxfmt lint-staged exclude. Also corrects the preserves-other-props output fixture to match what jscodeshift 17 actually produces (inline />). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
commit: |
📊 Package size report No changes
Unchanged files
🤖 This report was automatically generated by pkg-size-action |
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
Port of the codemod ESM modernization from
maintov5."type": "module"+ tsconfig updated tomodule: nodenext/moduleResolution: nodenext/target: es2022bin/cli.ts: named ESM imports throughout;createRequire/fileURLToPathpolyfills forrequire/__dirname; typedRunTransformOptionsinterface; properAnyFlagsschema for meow v14; typed inquirer promptbin/crs-codemod.ts:require("./cli").run()→ ESMimport { run } from "./cli.js"@types/*aligned;@types/inquirerremoved (types are now bundled)vitest+test/test:watch/test:updatescripts;tests/v5.test.tswith fixture-based snapshot tests covering 5 cases (basic, aliased imports, all select variants, prop preservation, unrelated-library guard)codemod/tests/fixtures/**from oxfmt — fixture files must exactly match the transform output (jscodeshift formats JSX independently of oxfmt, and they disagree on/>placement for multi-prop elements)Test plan
pnpm --filter crs-codemod test— 5/5 passpnpm --filter crs-codemod build— clean TypeScript compile🤖 Generated with Claude Code