Skip to content

Commit 3a46b62

Browse files
authored
fix: compile with tsc in gulp build
1 parent e8f76ac commit 3a46b62

1 file changed

Lines changed: 11 additions & 13 deletions

File tree

gulpfile.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
'use strict';
1010

1111
const gulp = require('gulp');
12-
const ts = require('gulp-typescript');
1312
const spawn = require('cross-spawn');
1413
const path = require('path');
1514
const del = require('del');
@@ -20,22 +19,21 @@ const nativeDependencyChecker = require('node-has-native-dependencies');
2019
const flat = require('flat');
2120
const { argv } = require('yargs');
2221
const os = require('os');
23-
const typescript = require('typescript');
24-
25-
const tsProject = ts.createProject('./tsconfig.json', { typescript });
26-
2722
const isCI = process.env.TRAVIS === 'true' || process.env.TF_BUILD !== undefined;
2823

2924
gulp.task('compileCore', (done) => {
30-
let failed = false;
31-
tsProject
32-
.src()
33-
.pipe(tsProject())
34-
.on('error', () => {
35-
failed = true;
25+
spawnAsync(process.execPath, ['./node_modules/typescript/lib/tsc.js', '-p', './tsconfig.json'], undefined, true)
26+
.then((stdout) => {
27+
if (stdout.includes('error')) {
28+
done(new Error(stdout));
29+
} else {
30+
done();
31+
}
3632
})
37-
.js.pipe(gulp.dest('out'))
38-
.on('finish', () => (failed ? done(new Error('TypeScript compilation errors')) : done()));
33+
.catch((ex) => {
34+
console.log(ex);
35+
done(new Error('TypeScript compilation errors', ex));
36+
});
3937
});
4038

4139
gulp.task('compileApi', (done) => {

0 commit comments

Comments
 (0)