• codemod : входной-исходный файл -> [скрипт преобразования] -> выходной-преобразованный исходный файл
  • jscodeshift : оболочка вокруг recast и ast-типов. Recast обрабатывает преобразование из исходного кода в AST и обратно. Ast-types обрабатывает низкоуровневое взаимодействие с узлами AST.
LXXXXX:code_mods krishav$ jscodeshift --help
Usage: jscodeshift <path>… [options]
path Files or directory to transform
Options:
 -t FILE, — transform FILE Path to the transform file. Can be either a local path or url [./transform.js]
 -c, — cpus (all by default) Determines the number of processes started.
 -v, — verbose Show more information about the transform process [0]
 -d, — dry Dry run (no changes are made to files)
 -p, — print Print output, useful for development
 — babel Apply Babel to transform files [true]
 — extensions File extensions the transform file should be applied to [js]
 — ignore-pattern Ignore files that match a provided glob expression
 — ignore-config FILE Ignore files if they match patterns sourced from a configuration file (e.g., a .gitignore)
 — run-in-band Run serially in the current process [false]
 -s, — silent No output [false]
 — parser The parser to use for parsing your source files (babel | babylon | flow) [babel]
 — version print version and exit
 
LXXXXX:code_mods krishav$ jscodeshift jscodeshift -t some-transform.js input-file.js -d -p

Блоги/коды/документация
1. https://www.toptal.com/javascript/write-code-to-rewrite-your-code#
2. https://github.com/facebook/jscodeshift/wiki/jscodeshift-Documentation
3. https://github.com/serapath/knowledge/blob/master/javascript/reference/ast/jscodeshift. md
4. https://github.com/fkling/astexplorer/blob/master/scripts/defs/jscodeshift.yaml
5. https://github.com/benjamn/ ast-types
6. https://github.com/facebook/jscodeshift/blob/master/README.md
7. https://vramana.github.io/blog/ 2015/12/21/codemod-tutorial/
8. https://thecuriousdeveloper.com/2017/11/20/codemods-with-jscodeshift/
9. https:// www.fullstackreact.com/articles/using-jscodeshift-with-react-codemod-to-update-createclass-components-to-es6-classes/
10. https://medium.com/@andrew_levine /writing-your-very-first-codemod-with-jscodeshift-7a24c4ede31b
11. https://github.com/reergymerej/jscodeshift-article/blob/master/signature-chang e.js
12. https://github.com/sejoker/awesome-jscodeshift