自动更新package.json版本 [英] update package.json version automatically
本文介绍了自动更新package.json版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我做一个小版本并对其进行标记之前,我想更新package.json以反映该程序的新版本。
有没有如何自动编辑文件 package.json
?
使用 git pre-释放钩子
help?
解决方案
npm版本
可能是正确的答案。只是为了给出一个替代方案,我建议咕噜咕噜。它由来自angular.js的其中一个人维护。
用法:
grunt bump
>>版本撞到0.0.2
grunt bump:patch
>>版本撞到0.0.3
grunt bump:minor
>>版本撞到0.1.0
grunt bump
>>版本撞到0.1.1
grunt bump:major
>>版本碰到1.0.0
如果您使用grunt,它可能是最简单的解决方案。 / p>
Before I do a small release and tag it, I'd like to update the package.json to reflect the new version of the program.
Is there a way to edit the file package.json
automatically?
Would using a git pre-release hook
help?
解决方案
npm version
is probably the correct answer. Just to give an alternative I recommend grunt-bump. It is maintained by one of the guys from angular.js.
Usage:
grunt bump
>> Version bumped to 0.0.2
grunt bump:patch
>> Version bumped to 0.0.3
grunt bump:minor
>> Version bumped to 0.1.0
grunt bump
>> Version bumped to 0.1.1
grunt bump:major
>> Version bumped to 1.0.0
If you're using grunt anyway it might be the simplest solution.
这篇关于自动更新package.json版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文