1.0.2 • Published 1 year ago
@wm-hosp/codemod v1.0.2
WM Codemods
Codemod 是以编程方式在代码库上运行的转换。这允许以编程方式应用大量更改,而无需手动遍历每个文件。
Usage
命令行中,切换到项目目录下,执行:
npx @wm-hosp/codemod <transform> <path>将 <transform> 和 <path> 替换为对应的值。
transform: 所要执行的转换path: 所要执行的转换的文件夹或者文件--dry: 执行转换,但不会实际修改代码--print: 打印出转换后的代码
Transforms
remove-barrel-file-import
移除项目中对 barrel file 文件的引用
npx @wm-hosp/codemod remove-barrel-file-import src --jscodeshift=--barrelFile=src/components/index.ts一定要指定
--jscodeshift=--barrelFile=src/components/index.ts参数,否则会导致无法找到 barrel file 文件