Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
fix: default root to parent path
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jan 19, 2018
1 parent 6bc8458 commit 48e8261
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ export function isIConfig(o: any): o is IConfig {
return !!o._base
}

export async function read({name, root = __dirname, baseConfig}: ConfigOptions = {}): Promise<IConfig> {
export async function read({name, root, baseConfig}: ConfigOptions = {}): Promise<IConfig> {
root = root || (module.parent && module.parent.parent && module.parent.parent.filename) || __dirname
const pkgPath = await findPkg(name, root)
if (!pkgPath) throw new Error(`could not find package.json with ${inspect({name, root})}`)
debug('found package.json at %s from %s', pkgPath, root)
Expand Down

0 comments on commit 48e8261

Please sign in to comment.