-
Notifications
You must be signed in to change notification settings - Fork 80
/
gulpfile.js
41 lines (34 loc) · 1.18 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
var gulp = require('gulp');
var concat = require('gulp-concat');
var karma = require('gulp-karma');
var closureCompiler = require('google-closure-compiler').gulp();
var rename = require('gulp-rename');
var replace = require('gulp-replace');
var testFiles = [
'src/le.js',
'test/sinon*.js',
'test/*Spec.js'
];
var apiVersion = 1;
var apiEndpoint = 'js.logentries.com/v' + apiVersion;
var webhookEndpoint = 'webhook.logentries.com/noformat';
gulp.task('default', ['test', 'build']);
gulp.task('watch', function() {
gulp.watch('src/le.js', ['test']);
});
gulp.task('build', function() {
return gulp.src('src/le.js')
.pipe(concat('le.js')) // We've only got one file but still need this
.pipe(replace(/localhost:8080\/v1/g, apiEndpoint))
.pipe(replace(/localhost:8080\/noformat/g, webhookEndpoint))
.pipe(gulp.dest('product'))
.pipe(closureCompiler({
compilation_level: 'SIMPLE_OPTIMIZATIONS',
warning_level: 'VERBOSE',
debug: false,
language_in: 'ECMASCRIPT5_STRICT',
externs: 'deps/umd-extern.js'
}))
.pipe(rename('le.min.js'))
.pipe(gulp.dest('product'));
});