-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
35 lines (31 loc) · 1.09 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
var gulp = require('gulp');
var debug = require('gulp-debug');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var ts = require('gulp-typescript');
var smaps = require('gulp-sourcemaps');
var merge = require('merge-stream');
console.log('__dirname: ' + __dirname);
console.log('__filename: ' + __filename);
var dist = 'dist';
gulp.task('build_wux', function(){
// The actual path of gulp.dest also depends on the outFile attribute defined in tsconfig.json.
// For this reason the outFile attribute is redefined in createProject.
let tsprj = ts.createProject('./ts/wux/tsconfig.json', {"declaration": true, "outFile": "wux.js"});
let tsout = tsprj.src().pipe(tsprj());
return merge([
tsout.dts
.pipe(gulp.dest(dist))
.pipe(debug())
,
tsout.js
.pipe(gulp.dest(dist))
.pipe(rename({suffix: ".min"}))
.pipe(smaps.init())
.pipe(uglify())
.pipe(smaps.write('./'))
.pipe(gulp.dest(dist))
.pipe(debug())
]);
});
gulp.task('default', gulp.series('build_wux'));