Skip to content

Commit

Permalink
Update gulpfile
Browse files Browse the repository at this point in the history
  • Loading branch information
taoyuan committed Mar 2, 2016
1 parent 8e157d4 commit 65b5f3d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
33 changes: 17 additions & 16 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,39 @@
'use strict';

var path = require('path');
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var excludeGitignore = require('gulp-exclude-gitignore');
var mocha = require('gulp-mocha');
var jshint = require('gulp-jshint');
var nsp = require('gulp-nsp');
var istanbul = require('gulp-istanbul');
var nsp = require('gulp-nsp');
var plumber = require('gulp-plumber');
var coveralls = require('gulp-coveralls');

var handleErr = function (err) {
console.log(err.message);
process.exit(1);
};

gulp.task('static', function () {
return gulp.src(['**/*.js', '!coverage/**'])
return gulp.src('**/*.js')
.pipe(excludeGitignore())
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'))
.on('error', handleErr);
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});

gulp.task('nsp', function (cb) {
nsp('package.json', cb);
nsp({package: path.resolve('package.json')}, cb);
});

gulp.task('pre-test', function () {
return gulp.src('lib/**/*.js')
.pipe(istanbul({includeUntested: true}))
.pipe(excludeGitignore())
.pipe(istanbul({
includeUntested: true
}))
.pipe(istanbul.hookRequire());
});

gulp.task('test', ['pre-test'], function (cb) {
var mochaErr;

gulp.src('test/**/*.test.js')
gulp.src('test/**/*.js')
.pipe(plumber())
.pipe(mocha({reporter: 'spec'}))
.on('error', function (err) {
Expand All @@ -49,6 +45,10 @@ gulp.task('test', ['pre-test'], function (cb) {
});
});

gulp.task('watch', function () {
gulp.watch(['lib/**/*.js', 'test/**'], ['test']);
});

gulp.task('coveralls', ['test'], function () {
if (!process.env.CI) {
return;
Expand All @@ -58,4 +58,5 @@ gulp.task('coveralls', ['test'], function () {
.pipe(coveralls());
});

gulp.task('prepublish', ['nsp']);
gulp.task('default', ['static', 'test', 'coveralls']);
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,15 @@
},
"devDependencies": {
"chai": "~3.5.0",
"eslint-config-xo-space": "^0.10.0",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-coveralls": "^0.1.4",
"gulp-eslint": "^2.0.0",
"gulp-exclude-gitignore": "^1.0.0",
"gulp-istanbul": "^0.10.3",
"gulp-jscs": "^3.0.2",
"gulp-jshint": "^2.0.0",
"gulp-mocha": "^2.2.0",
"gulp-nsp": "^2.3.0",
"gulp-plumber": "^1.1.0",
"jshint-stylish": "^2.1.0",
"mocha": "~2.4.5"
}
}

0 comments on commit 65b5f3d

Please sign in to comment.