Skip to content

Commit

Permalink
refactor: don't resolve path twice
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Jul 12, 2022
1 parent c8dc8d2 commit afb6ab7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { isAbsolute, join } from 'pathe'
import { PackageJson } from './types'
import { findNearestFile } from './utils'
import { isFile } from './_utils'
import { resolvePackageJSON } from '.'

const rootFiles = ['pnpm-workspace.yaml', 'pnpm-lock.yaml', 'yarn.lock', 'lerna.json']

Expand All @@ -29,6 +28,6 @@ export async function findWorkspaceRoot (id: string = process.cwd(), opts: Resol
...opts
})
} catch {
return resolvePackageJSON(id, opts)
return findNearestFile('package.json', { startingFrom: resolvedPath, ...opts })
}
}

0 comments on commit afb6ab7

Please sign in to comment.