moved typescript task function into a function factory

This commit is contained in:
Ken 2018-12-06 15:39:59 -08:00
Родитель 2aa3d2b219
Коммит 02367ccf6c
2 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -18,12 +18,16 @@ export function tscTask(options: ts.CompilerOptions) {
[tscCmd] [tscCmd]
); );
const cp = spawn(process.execPath, args, { stdio: 'inherit' }); const cp = spawn(process.execPath, args, { stdio: 'pipe' });
cp.stdout.on('data', data => { cp.stdout.on('data', data => {
this.logger.info(data.toString().trim()); this.logger.info(data.toString().trim());
}); });
cp.stderr.on('error', data => {
this.logger.error(data.toString().trim());
});
cp.on('exit', code => { cp.on('exit', code => {
if (code !== 0) { if (code !== 0) {
return done(new Error('Error in typescript')); return done(new Error('Error in typescript'));

Просмотреть файл

@ -1,7 +1,7 @@
const { spawn } = require('child_process'); const { spawn } = require('child_process');
['', 'typescript', 'webpack'].forEach(pkg => { ['', 'typescript', 'webpack'].forEach(pkg => {
const name = ['build', 'rig', ...(pkg ? [pkg] : [])]; const name = ['just', 'task', ...(pkg ? [pkg] : [])];
const cp = spawn('tsc', ['-p', `packages/${name.join('-')}`, '-w', '--preserveWatchOutput'], { stdio: 'pipe' }); const cp = spawn('tsc', ['-p', `packages/${name.join('-')}`, '-w', '--preserveWatchOutput'], { stdio: 'pipe' });
cp.stdout.pipe(process.stdout); cp.stdout.pipe(process.stdout);