Skip to content

Commit 6cc5d2e

Browse files
authored
fix: change installOptions to use npm in yarn PM (electron-userland#9197)
fix electron-userland#9187 electron-userland#9169
1 parent 2dfaacc commit 6cc5d2e

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.changeset/afraid-icons-yawn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"app-builder-lib": patch
3+
---
4+
5+
fix: change installOptions to use npm in yarn PM

packages/app-builder-lib/src/node-module-collector/packageManager.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ export function detectPackageManager(cwd: string): PM {
7777
if (npm) detected.push(PM.NPM)
7878

7979
if (detected.length === 1) {
80-
return detected[0] === PM.YARN ? detectPackageManagerByEnv() : detected[0]
80+
if (detected[0] === PM.YARN) {
81+
return detectPackageManagerByEnv() === PM.YARN_BERRY ? PM.YARN_BERRY : PM.YARN
82+
}
83+
return detected[0]
8184
}
8285

8386
// fallback: multiple lockfiles or none

packages/app-builder-lib/src/node-module-collector/yarnNodeModulesCollector.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ export class YarnNodeModulesCollector extends NpmNodeModulesCollector {
77
}
88

99
// note: do not override instance-var `pmCommand`. We explicitly use npm for the json payload
10-
public readonly installOptions = { manager: PM.YARN, lockfile: "yarn.lock" }
10+
// yarn list cannot get the detailed dependencies path info, But we can use npm to get all dependencies path info
11+
public readonly installOptions = { manager: PM.NPM, lockfile: "yarn.lock" }
1112
}

0 commit comments

Comments
 (0)