import { cosmiconfigSync } from "cosmiconfig" ; import path from "path" ; import { KitConfig } from "./kitConfig" ; /**
 * Options for retrieving a kit config. The default is equivalanet to passing { cwd: process.cwd() }
 */ export type GetKitConfigOptions = { /**
     * Retrieve the kit config options, if they exist, from the specified module.
     */ module ? : string ; /**
     * Retrive teh kit config options, using the target working directory.
     */ cwd ? : string ; } ; export function getKitConfig ( options = { } ) { const cwd = options . module ? path . dirname ( require . resolve ( options . module + "/package.json" ) ) : options . cwd || process . cwd ( ) ; const explorerSync = cosmiconfigSync ( "rnx-kit" , { stopDir : cwd } ) ; const result = explorerSync . search ( cwd ) ; return result ?. config ?? null ; }