import Path from 'path' ; import Fs from 'fs' ; import { promisify } from 'util' ; const existsAsync = promisify ( Fs . exists ) ; export async function findOpenSearchDashboardsJson ( directory ) { if ( await existsAsync ( Path . resolve ( directory , 'opensearch_dashboards.json' ) ) ) { return directory ; } const parent = Path . dirname ( directory ) ; if ( parent === directory ) { return undefined ; } return findOpenSearchDashboardsJson ( parent ) ; }