-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
71 lines (61 loc) · 2.01 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
var gulp = require('gulp');
var PATHS = {
src: {
js: 'src/**/*.ts',
test: 'test/**/*.spec.ts',
html: 'src/**/*.html'
},
lib: [
'node_modules/angular2/node_modules/traceur/bin/traceur-runtime.js',
'node_modules/systemjs/dist/system-csp-production.js',
'node_modules/angular2/bundles/angular2.js'
],
typings: 'node_modules/angular2/bundles/typings/angular2/angular2.d.ts'
};
gulp.task('clean', function (done) {
var del = require('del');
del(['dist'], done);
});
gulp.task('js', function () {
var typescript = require('gulp-typescript');
var tsResult = gulp.src([PATHS.src.js, PATHS.typings])
.pipe(typescript({
typescript: require('typescript'), //use the version of TypeScript from this repo
noImplicitAny: true,
module: 'system',
target: 'ES5',
emitDecoratorMetadata: true,
experimentalDecorators: true
}));
return tsResult.js.pipe(gulp.dest('dist'));
});
gulp.task('html', function () {
return gulp.src(PATHS.src.html).pipe(gulp.dest('dist'));
});
gulp.task('libs', function () {
return gulp.src(PATHS.lib).pipe(gulp.dest('dist/lib'));
});
gulp.task('test', function (done) {
var Server = require('karma').Server;
new Server({
browsers: ['Chrome'],
frameworks: ['jasmine'],
files: [
PATHS.lib[0], PATHS.lib[1], PATHS.lib[2], //TODO: do it better
PATHS.src.js,
PATHS.src.test,
'build/tests-bootstrap.js'
],
preprocessors: {
'**/*.ts': ['TypeScript']
},
plugins: ['karma-jasmine', 'karma-chrome-launcher', require('./build/karma-typescript-preprocessor')],
singleRun: true
}, done).start();
});
gulp.task('play', ['libs', 'html', 'js'], function () {
var httpPlay = require('http-play');
gulp.watch(PATHS.src.html, ['html']);
gulp.watch(PATHS.src.js, ['js']);
httpPlay({dist: __dirname + '/dist', port: 9000});
});