do not throw execa error when building ts refs (#102154)

This commit is contained in:
Mikhail Shustov 2021-06-16 10:55:22 +02:00 committed by GitHub
parent aea2a384fd
commit 5c90bacce5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 5 deletions

View file

@ -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 };
}

View file

@ -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