我正在从材料UI 0.x更新到1.0。
文件 migration-helper 说要跑:
jscodeshift -t <codemod-script> <path>.
我以前从未使用过jscodeshift,也从未见过这种符号,所以我想得到一些关于如何使用它的建议。:)谷歌搜索 jscodeshift codemod-script 没有任何相关信息。
jscodeshift codemod-script
做什么 codemod-script 需要吗?
codemod-script
我花了点时间才弄明白。安装jscodeshift和材料ui codemods后,命令的格式应如下所示:
jscodeshift -t <the file path of the specific code mod file> <the location of the files you want to process>
jscodeshift -t ./node_modules/@material-ui/codemod/lib/v1.0.0/svg-icon-imports.js ./src/
我还对文件使用扩展名jsx,因此必须添加--extensions标志:
jscodeshift -t ./node_modules/@material-ui/codemod/lib/v1.0.0/svg-icon-imports.js ./src/ --extensions jsx