-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
74 lines (64 loc) · 1.91 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
var gulp = require('gulp');
var del = require('del');
var merge = require('merge2'); // Require separate installation
var concat = require('gulp-concat');
// ts
var ts = require('gulp-typescript');
var tsProject = ts.createProject('tsconfig.json', { sortOutput: true });
var Builder = require('systemjs-builder');
gulp.task('clean', function () {
return del([
//'dist/report.csv',
// here we use a globbing pattern to match everything inside the `mobile` folder
'forms_a2/**/*',
// we don't want to clean this file though so we negate the pattern
//'!dist/mobile/deploy.json'
]);
});
// replace the Gulp task for ts with this:
gulp.task('ts',['clean'], function(done) {
var tsResult = gulp.src([
"node_modules/angular2/bundles/typings/angular2/angular2.d.ts",
"node_modules/@reactivex/rxjs/dist/es6/Rx.d.ts",
"typings/main/ambient/es6-shim/es6-shim.d.ts",
"src/**/*.ts"
])
.pipe(ts(tsProject), undefined, ts.reporter.fullReporter());
return merge([
tsResult.dts.pipe(gulp.dest('forms_a2')),
tsResult.js.pipe(gulp.dest('forms_a2')),
//tsResult.js.pipe(concat('bundle_temp.js')).pipe(gulp.dest('dist/gulp'))
]);
});
gulp.task('bundle', ['ts'], build);
function build(done) {
var builder = new Builder({
paths: {
'*': '*.js'
},
map: {
angular2: 'node_modules/angular2'
},
meta: {
'angular2/*': { build: false }
},
packages: {
'angular2': {
defaultExtension: 'js',
main: 'core.js'
}
}
});
builder
// start building with the root module file in the folder with the intended module name
.bundle('forms_a2/forms_a2', 'forms_a2/bundle.js')
.then(function(output) {
console.log('Build complete');
})
.catch(function(err) {
console.log('Build error');
console.log(err);
})
.finally(done);
}
gulp.task('default',['bundle']);