== Chrome Extension Grunt Build Script
Gruntfile that builds your extension, archives it and puts in the /builds folder. Also can bump up manifest and package.json files and tag release.
| // Task configurations | |
| module.exports = function(grunt) { | |
| grunt.initConfig({ | |
| pkg: grunt.file.readJSON('manifest.json'), | |
| bumpup: { | |
| options: { | |
| updateProps: { | |
| pkg: 'manifest.json' | |
| } | |
| }, | |
| files: ['manifest.json', 'package.json'] | |
| }, | |
| tagrelease: '<%= pkg.version %>', | |
| zip: { | |
| 'long-format': { | |
| src: ['img/**', '*.js*','*.md','LICENSE', '!Gruntfile.js', '!package.json'], | |
| dest: 'builds/<%= pkg.name + "-" + pkg.version %>.zip' | |
| } | |
| } | |
| }); | |
| // Loading the plugins | |
| grunt.loadNpmTasks('grunt-bumpup'); | |
| grunt.loadNpmTasks('grunt-tagrelease'); | |
| grunt.loadNpmTasks('grunt-zip'); | |
| // Alias task for release | |
| grunt.registerTask('makeRelease', function (type) { | |
| type = type ? type : 'patch'; // Default release type | |
| grunt.task.run('bumpup:' + type); // Bump up the version | |
| grunt.task.run('tagrelease'); // Commit & tag the release | |
| grunt.task.run('zip'); // Compress an archive | |
| }); | |
| grunt.registerTask('default', []); | |
| grunt.registerTask('build', ['makeRelease']); | |
| grunt.registerTask('pack', ['zip']); | |
| } |
| { | |
| "name": "chrome-ext-pics-build", | |
| "version": "1.0.0", | |
| "author": "Alex Buznik", | |
| "dependencies": {}, | |
| "devDependencies": { | |
| "grunt": "~0.4.5", | |
| "grunt-cli": "*", | |
| "grunt-bumpup": "*", | |
| "grunt-release": "*", | |
| "grunt-tagrelease": "*", | |
| "grunt-zip": "*" | |
| } | |
| } |