-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
59 lines (49 loc) · 1.69 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
var gulp = require('gulp');
var tslint = require("gulp-tslint");
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var gulpTypings = require("gulp-typings");
var typescript = require('gulp-tsc');
var config = require('./gulp.config')();
var del = require('del');
var runSequence = require('run-sequence');
gulp.task('default', ['tslint-json']);
gulp.task("tslint-json", () =>
gulp.src(config.ng2bSrc.concat(config.demoSrc))
.pipe(tslint())
.pipe(tslint.report("prose"))
);
gulp.task('build', function(callback) {
runSequence('clean:all', 'install-typings', 'compile', ['uglify', 'copy-definition', 'copy-doc'], 'clean:build-dir', callback);
});
gulp.task("install-typings",function(){
return gulp.src(config.typingsConf)
.pipe(gulpTypings());
});
gulp.task('compile', function() {
return gulp.src(config.ng2bSrc.concat(config.typingsSrc))
.pipe(typescript(config.tscConf))
.pipe(gulp.dest(config.buildDir));
});
gulp.task('uglify', function() {
return gulp.src(config.buildJsSrc)
.pipe(uglify())
.pipe(gulp.dest(config.distDir))
.pipe(concat('ng2b-all.min.js'))
.pipe(gulp.dest(config.distDir + 'bundles'))
;
});
gulp.task('clean:all', function() {
return del.sync([config.buildDir, config.distDir, "!" + config.npmRelease]);
});
gulp.task('clean:build-dir', function() {
return del.sync([config.buildDir]);
});
gulp.task('copy-definition', function() {
return gulp.src([config.buildDir + '*.d.ts', config.buildDir + '**/*.d.ts'])
.pipe(gulp.dest(config.distDir))
})
gulp.task('copy-doc', function() {
return gulp.src('*.md')
.pipe(gulp.dest(config.npmRelease))
})