-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
96 lines (79 loc) · 1.9 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Generated on 2015-12-23 using generator-angular-fullstack 3.1.1
'use strict';
var _ = require('lodash');
var del = require('del');
var gulp = require('gulp');
var path = require('path');
var gulpLoadPlugins = require('gulp-load-plugins');
var lazypipe = require('lazypipe');
var runSequence = require('run-sequence');
var plugins = gulpLoadPlugins();
var config;
const paths = {
scripts: ['lib/**/*.js'],
tests: [ 'test/**/*.js', ],
unitTests: [ 'test/unit/**/*.js', ],
integrationTests: [ 'test/integration/**/*.js', ],
dist: 'dist'
};
/********************
* Reusable pipelines
********************/
let lintScripts = lazypipe()
.pipe(plugins.jshint, 'lib/.jshintrc')
.pipe(plugins.jshint.reporter, 'jshint-stylish');
/********************
* Tasks
********************/
gulp.task('clean', () => del(['dist/**']));
gulp.task('copy', () => {
return gulp.src([
'package.json',
'lib'
], { cwdbase: true })
.pipe(gulp.dest(paths.dist));
});
gulp.task('lint', () => {
return gulp.src(_.union(paths.scripts/*, paths.tests*/))
.pipe(lintScripts());
});
gulp.task('test', (cb) => {
return runSequence(
//'env:all',
//'env:test',
'mocha',
//'mocha:coverage',
cb);
});
function test(files) {
return gulp.src(files)
.pipe(plugins.mocha({
reporter: 'spec',
require: [ './test/mocha.conf' ]
}))
.once('end', function() {
process.exit();
});
}
gulp.task('mocha', () => {
return test(paths.tests);
});
gulp.task('mocha:unit', () => {
return test(paths.unitTests);
});
gulp.task('mocha:integration', () => {
return test(paths.integrationTests);
});
gulp.task('watch', () => {
plugins.watch(_.union(paths.scripts, paths.tests))
.pipe(plugins.plumber())
.pipe(lintScripts());
});
gulp.task('build', (cb) => {
runSequence(
'clean',
'lint',
'copy',
cb);
});
gulp.task('default', ['build']);