Skip to content

Commit

Permalink
fix: ensure pnpm binary is only called in vite dir to get vite packag…
Browse files Browse the repository at this point in the history
…e info (#278)

fix: don't call pnpm binary in test projects directory to avoid corepack error when project uses a different pm
  • Loading branch information
dominikg committed Jan 16, 2024
1 parent 9e356b8 commit 73094ca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,12 @@ async function buildOverrides(
*/
async function getVitePackageInfo(vitePath: string): Promise<PackageInfo> {
try {
const lsOutput = await $`pnpm --dir ${vitePath}/packages/vite ls --json`
const lsParsed = JSON.parse(lsOutput)
// run in vite dir to avoid package manager mismatch error from corepack
const current = cwd
cd(`${vitePath}/packages/vite`)
const lsOutput = $`pnpm ls --json`
cd(current)
const lsParsed = JSON.parse(await lsOutput)
return lsParsed[0] as PackageInfo
} catch (e) {
console.error('failed to retrieve vite package infos', e)
Expand Down

0 comments on commit 73094ca

Please sign in to comment.