Skip to content

Commit e0f8469

Browse files
zyy7259haoqunjiang
authored andcommitted
feat: allow custom packageManager other than npm/yarn/pnpm (#4620)
Closes #4483
1 parent 14ff94d commit e0f8469

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/@vue/cli/lib/util/ProjectPackageManager.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ class PackageManager {
7878
if (!SUPPORTED_PACKAGE_MANAGERS.includes(this.bin)) {
7979
throw new Error(`Unknown package manager: ${this.bin}`)
8080
}
81+
82+
this.execBin = process.env.VUE_CLI_PACKAGE_MANAGER_BIN || this.bin
8183
}
8284

8385
// Any command that implemented registry-related feature should support
@@ -162,7 +164,7 @@ class PackageManager {
162164

163165
async install () {
164166
const args = await this.addRegistryToArgs(PACKAGE_MANAGER_CONFIG[this.bin].install)
165-
return executeCommand(this.bin, args, this.context)
167+
return executeCommand(this.execBin, args, this.context)
166168
}
167169

168170
async add (packageName, isDev = true) {
@@ -171,7 +173,7 @@ class PackageManager {
171173
packageName,
172174
...(isDev ? ['-D'] : [])
173175
])
174-
return executeCommand(this.bin, args, this.context)
176+
return executeCommand(this.execBin, args, this.context)
175177
}
176178

177179
async upgrade (packageName) {
@@ -192,15 +194,15 @@ class PackageManager {
192194
...PACKAGE_MANAGER_CONFIG[this.bin].add,
193195
packageName
194196
])
195-
return executeCommand(this.bin, args, this.context)
197+
return executeCommand(this.execBin, args, this.context)
196198
}
197199

198200
async remove (packageName) {
199201
const args = [
200202
...PACKAGE_MANAGER_CONFIG[this.bin].remove,
201203
packageName
202204
]
203-
return executeCommand(this.bin, args, this.context)
205+
return executeCommand(this.execBin, args, this.context)
204206
}
205207
}
206208

0 commit comments

Comments
 (0)