forked from ClementVidal/angular2-log
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.js
More file actions
73 lines (60 loc) · 1.77 KB
/
gulpfile.js
File metadata and controls
73 lines (60 loc) · 1.77 KB
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
// Include gulp
var gulp = require('gulp');
// Include Gulp Plugins
var ts = require('gulp-typescript');
var gls = require('gulp-live-server');
var path = require('path');
/**
* Tasks for building, testing, and running demo
*/
// build_demo
var demoProject = ts.createProject('demo/src/tsconfig.json', {});
gulp.task('build_demo', function() {
var tsResult = gulp.src([
'node_modules/angular2/typings/browser.d.ts',
'demo/src/*.ts'
])
.pipe(ts(demoProject, ts.reporter.defaultReporter()));
return tsResult.js.pipe(gulp.dest('./demo/lib'));
});
// serve_demo
var server = null;
gulp.task('serve_demo', function() {
server = gls.static(['demo'], 8888);
server.start();
});
// watch demo sources files
gulp.task('watch_demo', function() {
gulp.watch(['demo/dist/js/*', 'demo/index.html'], function(file) {
var notif = {
type: 'changed',
path: __dirname + '/demo/index.html'
};
server.notify.apply(server, [notif]);
});
gulp.watch(['demo/src/*.ts'], ['build_demo']);
});
/**
* Tasks for building, and testing angular-log
*/
// build
var tsProject = ts.createProject('src/tsconfig.json', {});
gulp.task('build_src', function() {
var tsResult = gulp.src([
'node_modules/angular2/typings/browser.d.ts',
'src/*.ts'
])
.pipe(ts(tsProject, ts.reporter.defaultReporter()));
tsResult.dts.pipe(gulp.dest('./lib'));
return tsResult.js.pipe(gulp.dest('./lib'));
});
// build watch
gulp.task('watch_src', function() {
gulp.watch(['src/*.ts'], ['build_src']);
});
/**
* Generic tasks
*/
gulp.task('build', ['build_src', 'build_demo']);
gulp.task('demo', ['build', 'watch_src', 'watch_demo', 'serve_demo']);
gulp.task('default', ['demo']);