From 5544f9df4b1b115c5b42e9288516bab91159b139 Mon Sep 17 00:00:00 2001 From: alexlamsl Date: Wed, 6 Apr 2016 17:44:14 +0800 Subject: [PATCH] remove grunt-exec --- Gruntfile.js | 22 ++++++++++------------ package.json | 1 - 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index aa26df5..d6e331b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -5,7 +5,6 @@ module.exports = function(grunt) { grunt.util.linefeed = '\n'; grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), banner: '/*!\n' + ' * HTMLMinifier v<%= pkg.version %> (<%= pkg.homepage %>)\n' + @@ -45,12 +44,6 @@ module.exports = function(grunt) { } }, - exec: { - test: { - command: 'node ./test.js' - } - }, - uglify: { options: { banner: '<%= banner %>', @@ -70,14 +63,13 @@ module.exports = function(grunt) { htmllint: 'tests/lint-tests.html', htmlminifier: 'tests/index.html' } - }); grunt.loadNpmTasks('grunt-browserify'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-eslint'); - grunt.loadNpmTasks('grunt-exec'); require('time-grunt')(grunt); + var phantomjs = require('grunt-lib-phantomjs').init(grunt); var webErrors; phantomjs.on('fail.load', function() { @@ -94,7 +86,6 @@ module.exports = function(grunt) { webErrors += details.failed; grunt.log[webErrors ? 'error' : 'ok'](details.passed + ' of ' + details.total + ' passed, ' + details.failed + ' failed'); }); - grunt.registerMultiTask('web', function() { var done = this.async(); webErrors = 0; @@ -108,6 +99,14 @@ module.exports = function(grunt) { }); }); + var fork = require('child_process').fork; + grunt.registerTask('exec-test', function() { + var done = this.async(); + fork('./test').on('exit', function(code) { + done(!code); + }); + }); + grunt.registerTask('dist', [ 'browserify', 'uglify' @@ -116,10 +115,9 @@ module.exports = function(grunt) { grunt.registerTask('test', [ 'dist', 'eslint', - 'exec:test', + 'exec-test', 'web' ]); grunt.registerTask('default', 'test'); - }; diff --git a/package.json b/package.json index a281078..1971258 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "grunt-browserify": "5.0.x", "grunt-contrib-uglify": "1.0.x", "grunt-eslint": "18.0.x", - "grunt-exec": "0.4.x", "grunt-lib-phantomjs": "1.0.x", "lzma": "2.3.x", "minimize": "1.8.x", -- 2.34.1