forked from basvandenberg/ng-select
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
66 lines (54 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
"use strict";
var del = require('del');
var exec = require('child_process').exec;
var gulp = require('gulp');
var os = require('os');
var tslint = require('gulp-tslint');
// Build.
gulp.task('build', ['transpile:ts']);
gulp.task('watch', function() {
gulp.watch([
'./index.ts',
'./src/*.ts',
'!*/**/*.d.ts',
'!*/**/*.ngfactory.ts',
], [
'build'
]);
});
// Typescript --> Javascript.
gulp.task('clean:js', function() {
return del([
'./index.d.ts',
'./index.js.map',
'./index.js',
'./index.metadata.json',
'./index.ngfactory.ts',
'./src/**/*.d.ts',
'./src/**/*.js.map',
'./src/**/*.js',
'./src/**/*.metadata.json',
'./src/**/*.ngfactory.ts',
]);
});
gulp.task('lint:ts', function() {
return gulp.src([
'./index.ts',
'./src/*.ts',
'!*/**/*.d.ts',
'!*/**/*.ngfactory.ts'
])
.pipe(tslint({
formatter: "verbose"
}))
.pipe(tslint.report())
});
gulp.task('transpile:ts', ['clean:js', 'lint:ts'], function (cb) {
var cmd = os.platform() === 'win32' ?
'node_modules\\.bin\\ngc' : './node_modules/.bin/ngc';
exec(cmd, function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
});