我正在从 Material-UI 0.x 更新到 1.0。
migration-helper 的文档说跑:
jscodeshift -t <codemod-script> <path>.
我以前从未使用过 jscodeshift,也从未见过这种表示法,所以我想就如何使用它获得一些建议。 :) 谷歌搜索 jscodeshift codemod-script
没有找到任何相关内容。
codemod-script
需要是什么?
最佳答案
我花了一些时间才弄明白这一点。安装 jscodeshift 和 material-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
关于node.js - Material-UI 迁移助手 : codemod-script?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51758931/