Repository navigation
Expand file tree
/
Copy pathgulpfile.js
More file actions
87 lines (63 loc) · 1.77 KB
/
Copy pathgulpfile.js
File metadata and controls
87 lines (63 loc) · 1.77 KB
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
var gulp = require('gulp'),
concat = require('gulp-concat'),
less = require('gulp-less'),
exec = require('child_process').exec,
env = require('./env');
gulp.task('default', ['buildJs', 'buildJsVendors', 'buildLess', 'buildCssVendors']);
gulp.task('pre-commit', ['e2e']);
gulp.task('watch', ['default'], watch);
gulp.task('buildJs', buildJs);
gulp.task('buildJsVendors', buildJsVendors);
gulp.task('buildLess', buildLess);
gulp.task('buildCssVendors', buildCssVendors);
gulp.task('e2e', e2e);
gulp.task('clean', clean);
function watch() {
gulp.watch(env.lessAssetsToWatch(), ['buildLess']);
gulp.watch(env.jsAssetsToWatch(), ['buildJs'])
gulp.watch(env.APP_CONFIG_FILE, ['buildJs', 'buildLess']);
}
function buildJs() {
return gulp.src(env.jsAssetsSequence())
.pipe(concat(env.BUILD_FILE_PREFIX + '.js'))
.pipe(gulp.dest(env.buildDir()));
}
function buildJsVendors() {
return gulp.src(env.jsVendorSequence())
.pipe(concat('vendor.js'))
.pipe(gulp.dest(env.buildDir()));
}
function buildLess() {
return gulp
.src(env.mainLessFile())
.pipe(less())
.pipe(concat(env.BUILD_FILE_PREFIX + '.css'))
.pipe(gulp.dest(env.buildDir()));
}
function buildCssVendors() {
return gulp
.src(env.cssVendors())
.pipe(concat('vendor.css'))
.pipe(gulp.dest(env.buildDir()));
}
function e2e(done) {
var server,
webdriver,
protractor;
server = exec('node server.js');
webdriver = exec('webdriver-manager start');
protractor = exec('protractor e2e/conf.js');
protractor.stdout.on('data', function (buffer) {
process.stdout.write(buffer.toString());
});
protractor.once('close', function () {
server.kill();
webdriver.kill();
done();
process.exit(0);
});
}
function clean(done) {
var removal = exec('rm -rf ' + env.BUILD_DIR);
removal.once('close', done);
}