UPDATE:
The grunt-bump plugin only works for versions that meet the semantic versioning format. If I use a version, e.g., test-2.0.0
that doesn't meet semver, it doesn't work.
grunt-cli v1.4.2
Using a Gruntfile.js
, how can I set my package.json
to a specific version string that's not necessarily a semver version? I use the grunt-bump plugin, so I do this
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);
});
};
...then do this on the command line...
$ npm grunt build
However, package.json
is not updated to "version": "tag-2.0.0"
. What am I missing?
In Gulp I use the gulp-pipe
to write to a file.