有没有办法只在暂存 JS 文件时运行 NPM 脚本?具体来说,在 pre-commit
git hook 之后(使用 Husky )。我的 package.json
中有以下脚本:
"scripts": {
...
"test": "jest",
"precommit": "npm test",
...
},
如果有 JS 文件,我希望只运行 jest
。我怎样才能做到这一点?
最佳答案
你见过吗?
https://github.com/okonet/lint-staged
你可以这样配置:
Add
"lint-staged": { "*.js": "eslint" }
topackage.json
关于javascript - 仅在暂存 JS 文件时运行 NPM 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41051539/