gruntjs - Grunt bump package.json version -



gruntjs - Grunt bump package.json version -

i add together 'release' task:

class="lang-js prettyprint-override">grunt.initconfig({ ... shell: { release: { command: function(version) { homecoming 'git checkout -b release-' + version + ' devel'; } } } ... grunt.loadnpmtasks('grunt-bumpup'); grunt.loadnpmtasks('grunt-shell'); ... grunt.registertask('release', function() { grunt.task.run('bumpup'); var version = grunt.config.get('pkg').version; grunt.task.run('shell:release:' + version); });

but have following:

running "release" task running "bumpup" task bumped to: 1.2.5 running "shell:release:1.2.4" (shell) task switched new branch 'release-1.2.4' m gruntfile.js m package.json m src/manifest.json done, without errors.

so version bumped up, branch created previous version.

i think because package.json cached. can reread it?

var version = grunt.file.readjson('package.json').version; // old version

edit:

adding 'updateprops' bumpup config alter pkg version property, but:

grunt.registertask('release', function() { grunt.task.run('bumpup'); var version = grunt.config.get('pkg').version; grunt.log.writeln(version); // old version, because tasks run async? grunt.task.run('shell:release:' + version); });

works good:

grunt.initconfig({ pkg: grunt.file.readjson('package.json'), ... bumpup: { options: { updateprops: { pkg: 'package.json' } }, files: ['package.json', 'src/manifest.json'] }, shell: { release: { command: function() { homecoming 'git checkout -b release-' + grunt.config.get('pkg').version + ' devel'; } } }, ... grunt.loadnpmtasks('grunt-bumpup'); grunt.loadnpmtasks('grunt-shell'); ... grunt.registertask('release', ['lint', 'bumpup', 'shell:release']);

are sure have set updateprops alternative of grunt-bumpup plugin? allow specify files update new bumped version after bumpup task completed

grunt.initconfig({ ... bumpup: { options: { updateprops: { pkg: 'package.json' } }, file: 'package.json' } ... });

gruntjs

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -