import * as path from 'path' ; import { parseTelemetryRC } from '../config' ; import { TaskContext } from './task_context' ; export function parseConfigsTask ( ) { const opensearchDashboardsRoot = process . cwd ( ) ; const configRoots = [ opensearchDashboardsRoot ] ; return configRoots . map ( ( configRoot ) => ( { task : async ( context ) => { try { const configs = await parseTelemetryRC ( configRoot ) ; configs . forEach ( ( config ) => { context . roots . push ( { config } ) ; } ) ; } catch ( err ) { const { reporter } = context ; const reporterWithContext = reporter . withContext ( { name : configRoot } ) ; reporterWithContext . report ( err ) ; throw reporter ; } } , title : `Parsing configs in ${ configRoot }` , } ) ) ; }