-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgulpfile.js
63 lines (55 loc) · 1.21 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
'use strict';
var gulp = require('gulp');
var clean = require('gulp-clean');
var eslint = require('gulp-eslint');
var rename = require('gulp-rename');
var uglify = require('gulp-uglifyjs');
var browserify = require('gulp-browserify');
gulp.task('clean', function() {
gulp.src('./dist/*')
.pipe(clean({
read: false
}));
});
gulp.task('js', function() {
gulp.src('./browser.js')
.pipe(browserify({
read: false,
standalone: 'Vault',
debug: process.env.NODE_ENV === 'dev'
}))
.pipe(uglify())
.pipe(rename('vault.min.js'))
.pipe(gulp.dest('./dist'));
});
gulp.task('build', ['clean', 'js']);
gulp.task('eslint', function() {
return gulp.src([
'./*.js',
'lib/*.js'
])
.pipe(eslint())
.pipe(eslint.format())
.on('data', function(file) {
if (file.eslint.messages && file.eslint.messages.length) {
gulp.fail = true;
}
}
);
});
gulp.task('watch', function() {
gulp.watch([
'./lib/*.js'
], ['js']);
});
process.on('uncaughtException', function(err) {
console.log(err);
console.log('Stacktrace:');
console.log(err.stack);
process.exit(1);
});
process.on('exit', function() {
if (gulp.fail) {
process.exit(1);
}
});