-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
I've been working to set up my first couple codemods for some deprecated Redux Toolkit features over in reduxjs/redux-toolkit#2768 . So far so good. One thing that's different is that I'm writing the transform files as TS and compiling them with ts-node at runtime.
When I run the codemods, they work, but I get a Babel warning saying it's dealing with large files in node_modules:
$ npx @reduxjs/rtk-codemods createReducerBuilder ./modified/**/*.{js,ts}
Need to install the following packages:
@reduxjs/rtk-codemods
Ok to proceed? (y) y
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
Processing 2 files...
Spawning 2 workers...
Sending 1 files to free worker...
Sending 1 files to free worker...
[BABEL] Note: The code generator has deoptimised the styling of home\npm-cache\_npx\c7474bb40fa6e968\node_modules\lodash\lodash.js as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of home\npm-cache\_npx\c7474bb40fa6e968\node_modules\lodash\lodash.js as it exceeds the max of 500KB.
All done.
Results:
0 errors
0 unmodified
0 skipped
2 ok
I've tracked this backwards:
- It's a Babel warning about large files: The code generator has deoptimised the styling since it exceeds the max of 500KB. babel/babel#13676
jscodeshiftapparently compiles transforms by default, including anything they import: got ERR_REQUIRE_ESM on implicit-children eps1lon/types-react-codemod#62- There's a
--no-babelCLI arg forjscodeshiftthat tells it not to compile transforms: Improve/fix applying babel to the transformer facebook/jscodeshift#294 , https://github.com/eps1lon/types-react-codemod/pull/63/files#diff-a45e7ec5c1df24cb4bec3997fad609744e1890a3acb5e7acddc29a82dfa24a97R67-R68
However, codemod-cli has a hardcoded-ish list of jscodeshift args and doesn't provide a way to alter that:
codemod-cli/src/bin-support.js
Lines 26 to 33 in 4a126ec
| let binOptions = [ | |
| '-t', | |
| transformPath, | |
| '--extensions', | |
| extensions, | |
| ...transformerOptions, | |
| '--stdin', // tell jscodeshift to read the list of files from stdin | |
| ]; |
Any chance you could add a codemod-cli option to forward through the --no-babel arg in some form?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels