-
Notifications
You must be signed in to change notification settings - Fork 72
/
gulpfile.js
56 lines (49 loc) · 1.37 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
var gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
jasmine = require('gulp-jasmine'),
tsc = require('gulp-tsc'),
typescript = require('gulp-typescript'),
typedoc = require("gulp-typedoc");
var objectMerge = require('object-merge');
var tsProject = typescript.createProject('./tsconfig.json');
var tsConfig = require('./tsconfig.json');
var tsCompileDev = tsConfig.compilerOptions || {};
var tsCompileProd = objectMerge(tsCompileDev, {
"removeComments": true,
"declaration": false,
"sourceMap": false
});
gulp.task('build.js.dev', function () {
gulp.src(['./*.ts'])
.pipe(tsc(tsCompileDev))
.pipe(gulp.dest('.'));
});
gulp.task('build.js.prod', function () {
gulp.src(['./*.ts'])
.pipe(sourcemaps.init())
.pipe(tsc(tsCompileProd))
.pipe(uglify())
.pipe(rename({extname: ".min.js"}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist'));
});
gulp.task('test', function () {
return gulp.src('spec/test.js')
.pipe(jasmine());
});
gulp.task("typedoc", function () {
return gulp
.src(['./*.ts'])
.pipe(typedoc({
module: "commonjs",
target: "es5",
out: "docs/",
emitDecoratorMetadata: true,
experimentalDecorators: true,
name: "angular2-rest"
}))
;
});
gulp.task('default', ['build.js.dev', 'typedoc'])