forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
41 lines (30 loc) · 927 Bytes
/
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
'use strict';
// THIS CHECK SHOULD BE THE FIRST THING IN THIS FILE
// This is to ensure that we catch env issues before we error while requiring other dependencies.
require('./tools/check-environment')(
{requiredNpmVersion: '>=3.5.3 <4.0.0', requiredNodeVersion: '>=5.4.1 <6.0.0'});
let gulp = require('gulp');
gulp.task('tools:build', (done) => {
tsc('tools/', done)
});
gulp.task('serve', () => {
let connect = require('gulp-connect');
let cors = require('cors');
connect.server({
root: `${__dirname}/dist`,
port: 8000,
livereload: false,
open: false,
middleware: (connect, opt) => {
return [cors()];
}
});
});
function tsc(projectPath, done) {
let child_process = require('child_process');
child_process.spawn(
`${__dirname}/node_modules/.bin/tsc`,
['-p', `${__dirname}/projectPath`],
{stdio: 'inherit'}
).on('close', (errorCode) => done(errorCode));
}