From 97a44c29a8c9aaa0863a427b90f4d29b7f5baf02 Mon Sep 17 00:00:00 2001 From: Hyunje Alex Jun Date: Tue, 14 Oct 2014 01:27:15 +0100 Subject: [PATCH] Add grunt task to release new version. --- Gruntfile.js | 17 +++++++++++++++-- package.json | 9 +++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 9464b97..d9a6650 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -6,8 +6,7 @@ module.exports = function (grunt) { grunt.initConfig({ // Metadata. pkg: grunt.file.readJSON('perfect-scrollbar.jquery.json'), - version: grunt.file.readJSON('package.json').version, - banner: '/*! <%= pkg.title || pkg.name %> - v<%= version %>\n' + + banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %>\n' + '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n', @@ -59,6 +58,15 @@ module.exports = function (grunt) { dest: 'min/', 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-csslint'); grunt.loadNpmTasks('grunt-contrib-cssmin'); + grunt.loadNpmTasks('grunt-bump'); grunt.registerTask('default', 'List commands', function () { grunt.log.writeln(""); @@ -79,5 +88,9 @@ module.exports = function (grunt) { grunt.registerTask('lint', ['jshint', 'csslint']); grunt.registerTask('build', ['clean', 'uglify', 'cssmin']); grunt.registerTask('travis', ['lint']); + grunt.registerTask('release', 'Release a new version', function (arg) { + var bumpType = arg ? ':' + arg : ''; + grunt.task.run(['lint', 'bump' + bumpType, 'build']); + }); }; diff --git a/package.json b/package.json index 6ee19d5..fbd1082 100644 --- a/package.json +++ b/package.json @@ -7,11 +7,12 @@ }, "devDependencies": { "grunt": "~0.4.1", - "grunt-contrib-jshint": "~0.1.1", - "grunt-contrib-uglify": "~0.1.1", - "grunt-contrib-cssmin": "~0.6.1", + "grunt-bump": "0.0.16", + "grunt-contrib-clean": "~0.4.1", "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": { "test": "grunt travis --verbose"