Codemod 是一个工具/库,它可以帮你处理那些只有部分自动化功能,部分场合还需人工干预的大规模代码库。 示例代码:
-m Have regex work over multiple lines (e.g. have dot match newlines). By default, codemod applies the regex one line at a time. -d The path whose ancestor files are to be explored. Defaults to current dir. --start A path:line_number-formatted position somewhere in the hierarchy from which to being exploring, or a percentage (e.g. "--start 25%") of the way through to start. Useful if you're divvying up the substitution task across multiple people. --end A path:line_number-formatted position somewhere in the hierarchy just *before* which we should stop exploring, or a percentage of the way through, just before which to end. --extensions A comma-delimited list of file extensions to process. --include-extensionless If set, this will check files without an extension, along with any matching file extensions passed in --extensions --accept-all Automatically accept all changes (use with caution) --editor Specify an editor, e.g. "vim" or "emacs". If omitted, defaults to $EDITOR environment variable. --count Don't run normally. Instead, just print out number of times places in the codebase where the 'query' matches. --test Don't run normally. Instead, just run the unit tests embedded in the codemod library.