-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
77 lines (66 loc) · 1.89 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
var rollup = require('rollup');
var nodeResolve = require('rollup-plugin-node-resolve');
var commonjs = require('rollup-plugin-commonjs');
var uglify = require('rollup-plugin-uglify');
var exec = require('child_process').exec;
var gulp = require('gulp');
gulp.task('server', [], function (cb) {
var exec = require('child_process').exec;
exec('npm run lite', function(err) {
if (err) return cb(err); // 返回 error
cb(); // 完成 task
console.log("---------server--------------");
});
})
gulp.task('dev', ['ngc'], function () {
rollupFun();
});
gulp.task('ngc', [], function (cb) {
console.log("---------ngc entry--------------");
var exec = require('child_process').exec;
exec('npm run ngc', function(err) {
if (err) return cb(err); // 返回 error
cb(); // 完成 task
console.log("---------ngc--------------");
});
});
function rollupFun () {
console.log("---------rollupFun entry--------------");
rollup.rollup({
entry: 'tsOut/app/main.js',
plugins: [
nodeResolve({
jsnext: true,
module: true
}),
commonjs({
include: 'node_modules/rxjs/**',
}),
uglify()
]
}).then(function (bundle) {
bundle.write({
format: 'iife',
moduleName: 'main', //umd或iife模式下,若入口文件含 export,必须加上该属性
dest: 'dist/build.js',
sourceMap: true //加上这里即可
});
});
}
gulp.task('watch', ['server', 'dev'], function () {
gulp.watch('app/*.ts', ['dev'], function () {
console.log("---------change --------------");
});
});
gulp.task('test1', function () {
console.log('test1....');
});
gulp.task('test', function () {
gulp.watch('app/*.ts', ['dev'], function () {
console.log('change...');
});
});
// gulp.task('test', function () {
// roolup.rollup(roolupConfig).
// pipe(gulp.dest('dista'))
// })