Skip to content

Commit ded8080

Browse files
authored
Merge pull request #181 from tansongyang/programmatic-compilation-ts-precompile
Fix `ts:precompile`
2 parents 9f2f49b + 2443a51 commit ded8080

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/commands/precompile.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
'use strict';
33

44
const tmpdir = require('../utilities/tmpdir');
5+
const execa = require('execa');
56
const fs = require('fs-extra');
67
const path = require('path');
78
const walkSync = require('walk-sync');
@@ -26,13 +27,20 @@ module.exports = Command.extend({
2627

2728
// prettier-ignore
2829
let flags = [
30+
'--outDir', outDir,
31+
'--rootDir', project.root,
32+
'--allowJs', 'false',
33+
'--noEmit', 'false',
2934
'--declaration',
3035
'--sourceMap', 'false',
3136
'--inlineSourceMap', 'false',
3237
'--inlineSources', 'false',
3338
];
3439

35-
return compile({ project, outDir, flags }).then(() => {
40+
// Ensure the output directory is created even if no files are generated
41+
mkdirp.sync(outDir);
42+
43+
return execa('tsc', flags).then(() => {
3644
let output = [];
3745
for (let declSource of walkSync(outDir, { globs: ['**/*.d.ts'] })) {
3846
if (this._shouldCopy(declSource)) {

0 commit comments

Comments
 (0)