Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 307f8ad

Browse files
committed
chore(grunt): add grunt-bump to manage releases
1 parent 21fcad9 commit 307f8ad

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

Gruntfile.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,22 @@ module.exports = function(grunt) {
131131
}
132132
},
133133

134+
bump: {
135+
options: {
136+
files: ['package.json'],
137+
updateConfigs: ['pkg'],
138+
commit: true,
139+
commitMessage: 'Release v%VERSION%',
140+
commitFiles: ['package.json', 'dist/'], // '-a' for all files
141+
createTag: true,
142+
tagName: 'v%VERSION%',
143+
tagMessage: 'Version %VERSION%',
144+
push: true,
145+
pushTo: 'origin',
146+
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d' // options to use with '$ git describe'
147+
}
148+
},
149+
134150
watch: {
135151
files: ['libs/*.js', 'src/*.js', 'Gruntfile.js'],
136152
tasks: ['concat', 'uglify', 'cssmin']
@@ -144,8 +160,16 @@ module.exports = function(grunt) {
144160
grunt.loadNpmTasks('grunt-contrib-uglify');
145161
grunt.loadNpmTasks('grunt-contrib-cssmin');
146162
grunt.loadNpmTasks('grunt-contrib-yuidoc');
163+
grunt.loadNpmTasks('grunt-bump');
147164

148165
// Default task.
149-
grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'cssmin', 'yuidoc']);
166+
grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'cssmin']);
167+
grunt.registerTask('build', ['default']);
168+
grunt.registerTask('docs', ['yuidoc']);
169+
170+
grunt.registerTask('release', ['build', 'bump-only:patch', 'build', 'docs', 'bump-commit']);
171+
grunt.registerTask('release:minor', ['build', 'bump-only:minor', 'build', 'docs', 'bump-commit']);
172+
grunt.registerTask('release:major', ['build', 'bump-only:major', 'build', 'docs', 'bump-commit']);
173+
grunt.registerTask('release:git', ['build', 'bump-only:git', 'build', 'docs', 'bump-commit']);
150174

151175
};

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"grunt-contrib-cssmin": "~0.5.0",
3535
"grunt-contrib-yuidoc": "~0.4.0",
3636
"bower": "~0.9.2",
37-
"qunit": "~1.11.0"
37+
"qunit": "~1.11.0",
38+
"grunt-bump": "0.0.11"
3839
}
3940
}

0 commit comments

Comments
 (0)