2015-04-25 14:45:08 -07:00
|
|
|
'use strict';
|
|
|
|
|
2015-11-14 08:10:31 -08:00
|
|
|
// 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')(
|
2016-05-24 12:33:14 -07:00
|
|
|
{requiredNpmVersion: '>=3.5.3 <4.0.0', requiredNodeVersion: '>=5.4.1 <6.0.0'});
|
2015-11-14 08:10:31 -08:00
|
|
|
|
|
|
|
|
2016-05-24 12:33:14 -07:00
|
|
|
let gulp = require('gulp');
|
2015-11-26 23:45:40 -08:00
|
|
|
|
|
|
|
|
2016-05-24 12:33:14 -07:00
|
|
|
gulp.task('tools:build', (done) => {
|
|
|
|
tsc('tools/', done)
|
2015-06-10 16:52:19 -07:00
|
|
|
});
|
|
|
|
|
2015-04-27 15:24:32 -07:00
|
|
|
|
2016-05-24 12:33:14 -07:00
|
|
|
gulp.task('serve', () => {
|
|
|
|
let connect = require('gulp-connect');
|
|
|
|
let cors = require('cors');
|
2015-11-26 23:45:40 -08:00
|
|
|
|
2016-05-24 12:33:14 -07:00
|
|
|
connect.server({
|
|
|
|
root: `${__dirname}/dist`,
|
|
|
|
port: 8000,
|
|
|
|
livereload: false,
|
|
|
|
open: false,
|
|
|
|
middleware: (connect, opt) => {
|
|
|
|
return [cors()];
|
2016-04-28 21:57:16 -07:00
|
|
|
}
|
|
|
|
});
|
2015-04-24 10:15:52 -07:00
|
|
|
});
|
|
|
|
|
2015-04-27 00:46:48 -07:00
|
|
|
|
2016-05-24 12:33:14 -07:00
|
|
|
function tsc(projectPath, done) {
|
|
|
|
let child_process = require('child_process');
|
2015-02-20 17:44:23 -08:00
|
|
|
|
2016-05-24 12:33:14 -07:00
|
|
|
child_process.spawn(
|
|
|
|
`${__dirname}/node_modules/.bin/tsc`,
|
|
|
|
['-p', `${__dirname}/projectPath`],
|
|
|
|
{stdio: 'inherit'}
|
|
|
|
).on('close', (errorCode) => done(errorCode));
|
2015-08-27 10:39:39 -07:00
|
|
|
}
|