updeep-remeda/gulpfile.js

51 lines
1.3 KiB
JavaScript
Raw Normal View History

2015-08-02 06:25:08 +00:00
'use strict'; /* eslint strict:0, no-var:0, func-names:0 */
2015-07-31 15:53:25 +00:00
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var excludeGitignore = require('gulp-exclude-gitignore');
var mocha = require('gulp-mocha');
var nsp = require('gulp-nsp');
var babel = require('gulp-babel');
2015-08-02 05:51:56 +00:00
var watch = require('gulp-watch');
var batch = require('gulp-batch');
2015-08-02 07:48:08 +00:00
var rimraf = require('rimraf');
2015-07-31 15:53:25 +00:00
// Initialize the babel transpiler so ES2015 files gets compiled
// when they're loaded
require('babel-core/register');
2015-08-02 07:48:08 +00:00
gulp.task('clean', function(cb) {
rimraf('./dist', cb);
});
2015-08-02 06:25:08 +00:00
gulp.task('static', function() {
2015-07-31 15:53:25 +00:00
return gulp.src('**/*.js')
.pipe(excludeGitignore())
.pipe(eslint())
.pipe(eslint.format())
2015-08-01 15:13:25 +00:00
.pipe(eslint.failAfterError());
2015-07-31 15:53:25 +00:00
});
2015-08-02 06:25:08 +00:00
gulp.task('nsp', function(cb) {
2015-07-31 15:53:25 +00:00
nsp('package.json', cb);
});
2015-08-02 06:25:08 +00:00
gulp.task('test', function() {
2015-08-01 15:43:21 +00:00
return gulp.src('test/**/*.js')
.pipe(mocha({reporter: 'spec'}));
2015-07-31 15:53:25 +00:00
});
2015-08-02 07:48:08 +00:00
gulp.task('babel', ['clean'], function() {
2015-07-31 15:53:25 +00:00
return gulp.src('lib/**/*.js')
.pipe(babel())
.pipe(gulp.dest('dist'));
});
2015-08-02 06:25:08 +00:00
gulp.task('watch', function() {
watch(['lib/**/*.js', 'test/**/*.js'], batch(function(events, done) {
2015-08-02 05:51:56 +00:00
gulp.start('test', done);
}));
});
2015-07-31 15:53:25 +00:00
gulp.task('prepublish', ['nsp', 'babel']);
2015-08-01 15:43:21 +00:00
gulp.task('default', ['static', 'test']);