Registry / devops / code-migration-helpers

code-migration-helpers

JSON →
library0.6.1jsnpmunverified

A CLI toolset (v0.6.1) to automate common code migration tasks: adding extensions to relative imports (e.g., converting `./file` to `./file.js`), migrating Jest test constructs to Vitest (replacing `jest.fn()` with `vi.fn()`), and renaming file extensions (e.g., `.js` → `.cjs`). Designed for Node.js 18+ with a file-based scope; output may not be 100% accurate—always review changes. Lightweight alternative to codemods or jscodeshift for these specific patterns.

npm install code-migration-helpers
INSTALL
IMPORT
SIG · CODE-MIGRATION-HEL
C
code-migration-helpers
devopsjavascriptv0.6.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

code-migration-helpers (CLI)
npx code-migration-helpers <command>
npm run code-migration-helpers (unless defined as script)
Tool is intended to be run via npx or as a local devDependency; no programmatic API.
add-ext command
npx code-migration-helpers add-ext -f='./src' --from='.ts' --to='.js'
npx code-migration-helpers add-ext --file='./src'
Argument `-f` is required; `--from` and `--to` are optional.
jest-to-vitest command
npx code-migration-helpers jest-to-vitest -f='./tests'
npx code-migration-helpers vitest
Only transforms files matching Jest patterns; does not install Vitest.

Three common usage patterns: add extensions, migrate Jest to Vitest, rename file extensions.

# Add .js extension to all relative imports in a folder npx code-migration-helpers add-ext -f='./src' # Migrate Jest test constructs to Vitest npx code-migration-helpers jest-to-vitest -f='./tests' # Rename all .ts files to .mts npx code-migration-helpers rename-ext -f='./src' --from='.ts' --to='.mts'
Debug
Known issues
breakingModifications may not always be accurate; always review changes before committing.
fix
Work on a separate branch without existing changes so you can revert if needed.
affects: >=0.1.0
gotchaThe `add-ext` command may incorrectly modify non-relative imports (e.g., bare specifiers) if not careful.
fix
Use `--from` and `--to` filters to limit scope.
affects: >=0.1.0
gotchaThe `rename-ext` command example in README shows `jest-to-vitest` instead of `rename-ext`; the correct command is `npx code-migration-helpers rename-ext`.
fix
Use `npx code-migration-helpers rename-ext -f=... --from=... --to=...`
affects: 0.6.1
Errors
Common errors & fixes
npx: command not found: code-migration-helpers
Package not installed or npx cache issues
fix
Run `npm install code-migration-helpers -D` first, then use `npx code-migration-helpers`.
Error: No files found matching the given pattern
The `-f` argument points to a non-existent path or matches no files
fix
Ensure the path exists and contains relevant files. Use absolute or relative paths correctly.
Unexpected token '?' at code-migration-helpers(...)
Running on Node.js version < 18 which doesn't support newer syntax
fix
Upgrade Node.js to 18 or later.
Upgrade
Version history
0.6.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
10
Resources
code-migration-helpers — npm install code-migration-helpers · libregistry