import Path from 'path' ; import { ToolingLog , ProcRunner } from '@kbn/dev-utils' ; import { REPO_ROOT } from '@kbn/utils' ; import { ROOT_REFS_CONFIG_PATH } from './root_refs_config' ; import { Project } from './project' ; export async function buildTsRefs ( { log , procRunner , verbose , project , } ) { const relative = Path . relative ( REPO_ROOT , project ? project . tsConfigPath : ROOT_REFS_CONFIG_PATH ) ; log . info ( `Building TypeScript projects refs for ${ relative }...` ) ; try { await procRunner . run ( 'tsc' , { cmd : Path . relative ( REPO_ROOT , require . resolve ( 'typescript/bin/tsc' ) ) , args : [ '-b' , relative , '--pretty' , ... ( verbose ? [ '--verbose' ] : [ ] ) ] , cwd : REPO_ROOT , wait : true , } ) ; return { failed : false } ; } catch ( error ) { return { failed : true } ; } }