自动更新 package.json 版本 [英] update package.json version automatically

查看:45
本文介绍了自动更新 package.json 版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我做一个小版本并标记它之前,我想更新 package.json 以反映程序的新版本.

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.

有没有办法自动编辑文件package.json?

Is there a way to edit the file package.json automatically?

使用 git pre-release hook 会有帮助吗?

推荐答案

npm version 可能是正确的答案.为了提供替代方案,我推荐 grunt-bump.它由 angular.js 的一名人员维护.

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.

用法:

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

如果您无论如何都在使用 grunt,这可能是最简单的解决方案.

If you're using grunt anyway it might be the simplest solution.

这篇关于自动更新 package.json 版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆