-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
69 lines (54 loc) · 1.41 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
'use strict'
const gulp = require('gulp-help')(require('gulp'))
const coffee = require('gulp-coffee');
const cache = require('gulp-cached')
// Clean
gulp.task('clean:dist', () => {
const del = require('del')
delete cache.caches['build:src']
return del([ 'dist/*' ])
})
gulp.task('clean', [ 'clean:dist' ])
// Build
gulp.task('build:src', () => {
return gulp.src('src/**/*.coffee')
.pipe(cache('build:src'))
.pipe(coffee({bare: true}))
.pipe(gulp.dest('dist/lib'))
})
gulp.task('build', [ 'build:src' ])
// Dist
gulp.task('dist:package', () => {
return gulp.src('package.json')
.pipe(gulp.dest('dist'))
})
gulp.task('dist:readme', () => {
return gulp.src('README.md')
.pipe(gulp.dest('dist'))
})
gulp.task('dist:license', () => {
return gulp.src('LICENSE-MIT')
.pipe(gulp.dest('dist'))
})
gulp.task('dist', [ 'build', 'dist:package', 'dist:readme', 'dist:license' ])
// Test & Coverage
gulp.task('test:unit', () => {
require('coffee-script/register')
const mocha = require('gulp-mocha')
return gulp.src(['test/**/*.coffee'], { read: false })
.pipe(mocha({
require: [
'./test/setup'
],
timeout: 10000
}))
// .pipe(istanbul.writeReports({ dir: 'test/coverage' }))
.once('error', () => {
process.exit(1);
})
.once('end', () => {
process.exit();
})
});
gulp.task('test', [ 'test:unit' ])
gulp.task('default', [ 'help' ])