forked from angular/protractor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
52 lines (42 loc) · 1.34 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
'use strict';
var gulp = require('gulp');
var clangFormat = require('clang-format');
var gulpFormat = require('gulp-clang-format');
var runSequence = require('run-sequence');
var spawn = require('child_process').spawn;
var runSpawn = function(done, task, opt_arg) {
var child = spawn(task, opt_arg, {stdio: 'inherit'});
child.on('close', function() {
done();
});
};
gulp.task('built:copy', function() {
return gulp.src(['lib/**/*','!lib/**/*.ts'])
.pipe(gulp.dest('built/'));
});
gulp.task('webdriver:update', function(done) {
runSpawn(done, 'bin/webdriver-manager', ['update']);
});
gulp.task('jslint', function(done) {
runSpawn(done, './node_modules/.bin/jshint', ['lib','spec', 'scripts']);
});
gulp.task('clang', function() {
return gulp.src(['lib/**/*.ts'])
.pipe(gulpFormat.checkFormat('file', clangFormat))
.on('warning', function(e) {
console.log(e);
});
});
gulp.task('typings', function(done) {
runSpawn(done, 'node_modules/.bin/typings', ['install']);
});
gulp.task('tsc', function(done) {
runSpawn(done, 'node_modules/typescript/bin/tsc');
});
gulp.task('prepublish', function(done) {
runSequence(['typings', 'jslint', 'clang'],'tsc', 'built:copy', done);
});
gulp.task('pretest', function(done) {
runSequence(
['webdriver:update', 'typings', 'jslint', 'clang'], 'tsc', 'built:copy', done);
});