【发布时间】:2022-02-16 05:31:12
【问题描述】:
更新:
grunt-bump 插件仅适用于符合语义版本控制格式的版本。如果我使用不符合 semver 的版本,例如 test-2.0.0,它将不起作用。
grunt-cli v1.4.2
使用Gruntfile.js,如何将package.json 设置为不一定是semver 版本的特定版本字符串?我使用grunt-bump 插件,所以我这样做了
Gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
bump: {
options: {
files: ['package.json', 'package-lock.json'],
updateConfigs: ['pkg'],
versionType: 'patch',
...
},
...
});
...
var myTasks = [
"task1",
"clean",
....
"compress"
];
grunt.registerTask('build', 'Build version', function () {
grunt.config('bump.options.setVersion', "tag-2.0.0");
grunt.task.run(myTasks);
});
};
...然后在命令行上执行此操作...
$ npm grunt build
但是,package.json 未更新为 "version": "tag-2.0.0"。我错过了什么?
在 Gulp 中,我使用 gulp-pipe 写入文件。
【问题讨论】: