npm version
将更改提交到package.json并创建一个标记。有没有办法防止在使用此命令时执行挂钩?
不知道为什么之前这个功能在npm
中不存在,但是我在不久前做出了贡献,因为我自己需要它。它与[email protected]
一起发货。要使用它,请在commit-hooks = false
中设置配置选项.npmrc
,并且在创建版本提交时,底层git
调用将不会运行提交挂钩。如果您只想在单个版本控制上禁用提交挂钩,则可以运行类似于:
npm version --no-commit-hooks minor
或者:
npm version --commit-hooks false minor
根据npm cli docs,您可以通过使用跳过git标记的生成
npm --no-git-tag-version version
来自docs
提交钩
- 默认值:true
- 类型:布尔值
使用
npm version
命令时运行git commit hooks。
如果你只是想让这一次运行,请关注
npm version --no-commit-hooks patch|minor|major
要永久控制它,请运行以下命令
npm config set commit-hooks false
或者将此行添加到.npmrc
文件中
commit-hooks=false