UNPKG

@wagmi/cli

Version:

Manage and generate code from Ethereum ABIs

22 lines (18 loc) 640 B
import { bundleRequire } from 'bundle-require' import type { Config } from '../config.js' import type { MaybeArray } from '../types.js' type ResolveConfigParameters = { /** Path to config file */ configPath: string } /** Bundles and returns wagmi config object from path. */ export async function resolveConfig( parameters: ResolveConfigParameters, ): Promise<MaybeArray<Config>> { const { configPath } = parameters const res = await bundleRequire({ filepath: configPath }) let config = res.mod.default if (config.default) config = config.default if (typeof config !== 'function') return config return await config() }