-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
98 lines (76 loc) · 2.13 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
var gulp = require('gulp');
var ts = require('gulp-typescript');
var del = require("del");
var concat = require('gulp-concat');
//Config = require('./gulpfile.config'),
//tsProject = tsc.createProject('tsconfig.json');
//var config = new Config();
var gulpTasks = {
deleteWWW: function () {
del("www");
},
compileToOneFile: function() {
del("www").then(function() {
gulp.src('src/server/api/apiRoutes.ts')
.pipe(
ts({
noImplicitAny: false
,out: './output.js'
,target: "es5"
//"sourceMap": true,
//,module: 'commonjs' //'amd'
//,isolatedModules: false
})
)
.pipe(concat('output.js'))
.pipe(gulp.dest('www'));
});
},
compileProject: function() {
del("www").then(function() {
var tsFiles = [
"src/server/api/**/*.{ts,tsx}"
,"src/server/apiRoutes.ts"
//"src/**/*.ts"
];
var tsProject = ts.createProject('tsconfig.json');
var tsResult = gulp.src(tsFiles)
//.pipe(sourcemaps.init())
.pipe(ts(tsProject));
tsResult.js
.pipe(concat('output.js'))
.pipe(gulp.dest("www"));
});
}
}
gulp.task('clean', gulpTasks.deleteWWW);
gulp.task('ts', gulpTasks.compileToOneFile);
gulp.task('tsp', gulpTasks.compileProject);
//gulp.task('compile-ts', function () {
// var sourceTsFiles = [config.allTypeScript, //path to typescript files
// config.libraryTypeScriptDefinitions]; //reference to library .d.ts files
//
//
// var tsResult = gulp.src(sourceTsFiles)
// .pipe(sourcemaps.init())
// .pipe(tsc(tsProject));
//
// tsResult.dts.pipe(gulp.dest(config.tsOutputPath));
// return tsResult.js
// .pipe(sourcemaps.write('.'))
// .pipe(gulp.dest(config.tsOutputPath));
//});
//
///**
// * Remove all generated JavaScript files from TypeScript compilation.
// */
//gulp.task('clean-ts', function (cb) {
// var typeScriptGenFiles = [
// config.tsOutputPath +'/**/*.js', // path to all JS files auto gen'd by editor
// config.tsOutputPath +'/**/*.js.map', // path to all sourcemap files auto gen'd by editor
// '!' + config.tsOutputPath + '/lib'
// ];
//
// // delete the files
// del(typeScriptGenFiles, cb);
//});