jscodeshift

A JavaScript codemod toolkit.

MIT License

Downloads
28.3M
Stars
9.3K
Committers
121

Bot releases are visible (Hide)

jscodeshift -

Published by fkling about 9 years ago

New

  • ES7 support for transform files: Transform files (and its dependencies) are now passed through Babel (using Babel's require hook). That means you can use ES7 syntax in your transform files. If you already transpiled the transformer or don't use any ES6 features that need to be transpiled, you can pass the --no-babel option.
  • Directory traversal: Until now jscodeshift only worked on files. Now, if a path to a directory is passed, it will recursively find over all files matching the file extension provided through --extension (defaults to js).
  • Remove nodes: Node collections now have a .remove method which removes all selected nodes from the AST.
jscodeshift -

Published by fkling about 9 years ago

Changed

  • The --verbosity options is renamed to --verbose
  • Babel is used as parser, instead of esprima-fb. The resulting ASTs will be slightly different, which is why you might have to adapt existing codemods. You can use http://astexplorer.net/ with the parser "recast" and the parser configuration set to "babel" to learn about the new structure.
jscodeshift -

Published by fkling over 9 years ago

  • Bug fixes
  • replaceWith, insertAfter and insertBefore now accept arrays
  • new jscodeshift.template.* functions to interpolate AST nodes. See f866c37e7ff7d1a324c2968e571b5ffb7928eb93 and tests.