From fef23ef18b06e463ca6691ee3a730d9a4fff7441 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 16 Apr 2013 22:15:09 +0200 Subject: [PATCH] Build builds concurrently. --- Gruntfile.js | 31 +++++++++++++++++++------------ package.json | 1 + 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index d73545ddd..84468860b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -25,7 +25,7 @@ module.exports = function(grunt) { 'src/databoard.coffee', 'src/main.coffee' ], - dest: 'tmp/script.coffee' + dest: 'tmp-<%= pkg.type %>/script.coffee' }, crx: { options: concatOptions, @@ -33,7 +33,7 @@ module.exports = function(grunt) { 'builds/crx/manifest.json': 'src/manifest.json', 'builds/crx/script.js': [ 'src/banner.js', - 'tmp/script.js' + 'tmp-<%= pkg.type %>/script.js' ] } }, @@ -42,7 +42,7 @@ module.exports = function(grunt) { src: [ 'src/metadata.js', 'src/banner.js', - 'tmp/script.js' + 'tmp-<%= pkg.type %>/script.js' ], dest: 'builds/<%= pkg.name %>.js' }, @@ -53,7 +53,7 @@ module.exports = function(grunt) { 'builds/<%= pkg.name %>.user.js': [ 'src/metadata.js', 'src/banner.js', - 'tmp/script.js' + 'tmp-<%= pkg.type %>/script.js' ] } } @@ -68,10 +68,13 @@ module.exports = function(grunt) { }, coffee: { script: { - src: 'tmp/script.coffee', - dest: 'tmp/script.js' + src: 'tmp-<%= pkg.type %>/script.coffee', + dest: 'tmp-<%= pkg.type %>/script.js' } }, + concurrent: { + build: ['build-crx', 'build-userjs', 'build-userscript'] + }, exec: { commit: { command: function() { @@ -93,7 +96,8 @@ module.exports = function(grunt) { watch: { all: { options: { - interrupt: true + interrupt: true, + nospawn: true }, files: [ 'Gruntfile.js', @@ -121,11 +125,14 @@ module.exports = function(grunt) { }, clean: { builds: 'builds', - tmp: 'tmp' + tmpcrx: 'tmp-crx', + tmpuserjs: 'tmp-userjs', + tmpuserscript: 'tmp-userscript' } }); grunt.loadNpmTasks('grunt-bump'); + grunt.loadNpmTasks('grunt-concurrent'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-coffee'); grunt.loadNpmTasks('grunt-contrib-compress'); @@ -140,28 +147,28 @@ module.exports = function(grunt) { pkg.type = type; grunt.log.ok('pkg.type = %s', type); }); - grunt.registerTask('build', ['build-crx', 'build-userjs', 'build-userscript']); + grunt.registerTask('build', ['concurrent:build']); grunt.registerTask('build-crx', [ 'set-build:crx', 'concat:coffee', 'coffee:script', 'concat:crx', 'copy:crx', - 'clean:tmp' + 'clean:tmpcrx' ]); grunt.registerTask('build-userjs', [ 'set-build:userjs', 'concat:coffee', 'coffee:script', 'concat:userjs', - 'clean:tmp' + 'clean:tmpuserjs' ]); grunt.registerTask('build-userscript', [ 'set-build:userscript', 'concat:coffee', 'coffee:script', 'concat:userscript', - 'clean:tmp' + 'clean:tmpuserscript' ]); grunt.registerTask('release', ['exec:commit', 'exec:push', 'build-crx', 'compress:crx']); diff --git a/package.json b/package.json index a426e6c75..1217da64f 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "devDependencies": { "grunt": "~0.4.1", "grunt-bump": "~0.0.0", + "grunt-concurrent": "~0.1.1", "grunt-contrib-clean": "~0.4.0", "grunt-contrib-coffee": "~0.6.6", "grunt-contrib-compress": "~0.4.10",