Skip to content

Commit

Permalink
do not throw execa error when building ts refs (#102154)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshustov committed Jun 16, 2021
1 parent aea2a38 commit 5c90bac
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
16 changes: 12 additions & 4 deletions src/dev/typescript/build_ts_refs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,20 @@ import { ToolingLog, REPO_ROOT } from '@kbn/dev-utils';

export const REF_CONFIG_PATHS = [Path.resolve(REPO_ROOT, 'tsconfig.refs.json')];

export async function buildAllTsRefs(log: ToolingLog) {
export async function buildAllTsRefs(log: ToolingLog): Promise<{ failed: boolean }> {
for (const path of REF_CONFIG_PATHS) {
const relative = Path.relative(REPO_ROOT, path);
log.debug(`Building TypeScript projects refs for ${relative}...`);
await execa(require.resolve('typescript/bin/tsc'), ['-b', relative, '--pretty'], {
cwd: REPO_ROOT,
});
const { failed, stdout } = await execa(
require.resolve('typescript/bin/tsc'),
['-b', relative, '--pretty'],
{
cwd: REPO_ROOT,
reject: false,
}
);
log.info(stdout);
if (failed) return { failed };
}
return { failed: false };
}
6 changes: 5 additions & 1 deletion src/dev/typescript/run_type_check_cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ export async function runTypeCheckCli() {
process.exit();
}

await buildAllTsRefs(log);
const { failed } = await buildAllTsRefs(log);
if (failed) {
log.error('Unable to build TS project refs');
process.exit(1);
}

const tscArgs = [
// composite project cannot be used with --noEmit
Expand Down

0 comments on commit 5c90bac

Please sign in to comment.