Add grunt task to release new version.

This commit is contained in:
Hyunje Alex Jun 2014-10-14 01:27:15 +01:00
parent 467cdb17ed
commit 97a44c29a8
2 changed files with 20 additions and 6 deletions

View File

@ -6,8 +6,7 @@ module.exports = function (grunt) {
grunt.initConfig({ grunt.initConfig({
// Metadata. // Metadata.
pkg: grunt.file.readJSON('perfect-scrollbar.jquery.json'), pkg: grunt.file.readJSON('perfect-scrollbar.jquery.json'),
version: grunt.file.readJSON('package.json').version, banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %>\n' +
banner: '/*! <%= pkg.title || pkg.name %> - v<%= version %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n', ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
@ -59,6 +58,15 @@ module.exports = function (grunt) {
dest: 'min/', dest: 'min/',
ext: '.min.css' ext: '.min.css'
} }
},
bump: {
options: {
files: ['package.json', 'bower.json', 'perfect-scrollbar.jquery.json'],
updateConfigs: ['pkg'],
commit: false,
createTag: false,
push: false
}
} }
}); });
@ -68,6 +76,7 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-csslint'); grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-bump');
grunt.registerTask('default', 'List commands', function () { grunt.registerTask('default', 'List commands', function () {
grunt.log.writeln(""); grunt.log.writeln("");
@ -79,5 +88,9 @@ module.exports = function (grunt) {
grunt.registerTask('lint', ['jshint', 'csslint']); grunt.registerTask('lint', ['jshint', 'csslint']);
grunt.registerTask('build', ['clean', 'uglify', 'cssmin']); grunt.registerTask('build', ['clean', 'uglify', 'cssmin']);
grunt.registerTask('travis', ['lint']); grunt.registerTask('travis', ['lint']);
grunt.registerTask('release', 'Release a new version', function (arg) {
var bumpType = arg ? ':' + arg : '';
grunt.task.run(['lint', 'bump' + bumpType, 'build']);
});
}; };

View File

@ -7,11 +7,12 @@
}, },
"devDependencies": { "devDependencies": {
"grunt": "~0.4.1", "grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.1.1", "grunt-bump": "0.0.16",
"grunt-contrib-uglify": "~0.1.1", "grunt-contrib-clean": "~0.4.1",
"grunt-contrib-cssmin": "~0.6.1",
"grunt-contrib-csslint": "~0.1.2", "grunt-contrib-csslint": "~0.1.2",
"grunt-contrib-clean": "~0.4.1" "grunt-contrib-cssmin": "~0.6.1",
"grunt-contrib-jshint": "~0.1.1",
"grunt-contrib-uglify": "~0.1.1"
}, },
"scripts": { "scripts": {
"test": "grunt travis --verbose" "test": "grunt travis --verbose"