-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
72 lines (62 loc) · 1.97 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
var gulp = require('gulp'),
traceur = require('gulp-traceur'),
concat = require('gulp-concat'),
karma = require('gulp-karma'),
replace = require('gulp-replace');
var appFiles = 'src/**/*.js';
var testFiles = 'test/**/*.js';
var filesForKarma = [
'bower_components/angular/angular.js',
'dist/angularNext-standalone.js',
'test-build/**/*.js',
'testMain.js'
];
var traceurOptions = {
experimental: true,
modules: 'instantiate',
moduleName: true,
annotations: true,
types: true,
typeAssertions: true,
typeAssertionModule: "angular2/rtts-assert.js"
};
gulp.task('build-angular-next', function () {
gulp.src(appFiles)
.pipe(replace(/(import|export)( .*? from '.*?)\.js(';)/g, '$1$2$3'))
.pipe(gulp.dest('dist/es6'));
return gulp.src(appFiles)
.pipe(traceur(traceurOptions))
.pipe(concat('angularNext.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('build-test-files', function () {
return gulp.src(testFiles)
.pipe(traceur(traceurOptions))
.pipe(gulp.dest('test-build'));
});
gulp.task('build', ['build-angular-next', 'build-test-files'], function () {
gulp.src([
'bower_components/traceur-runtime/traceur-runtime.js',
'bower_components/es6-module-loader/dist/es6-module-loader.src.js',
'lib/systemjs-register/extension-register.js',
'lib/systemjs-register/initialize-register.js',
'dist/angularNext.js'])
.pipe(concat('angularNext-standalone.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('test', function () {
return gulp.src(filesForKarma)
.pipe(karma({
configFile: 'karma.conf.js',
action: 'run'
}));
});
gulp.task('default', ['build'], function () {
gulp.watch([appFiles], ['build']);
gulp.watch([testFiles], ['build-test-files']);
gulp.src(filesForKarma)
.pipe(karma({
configFile: 'karma.conf.js',
action: 'watch'
}));
});