Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: more accurate warning message for missing global peer dependenci…
…es (#5871)
- Loading branch information
Showing
3 changed files
with
29 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { execa, hasYarn, hasPnpm3OrLater } = require('@vue/cli-shared-utils') | ||
|
||
module.exports = function getGlobalInstallCommand () { | ||
if (hasYarn()) { | ||
const { stdout: yarnGlobalDir } = execa.sync('yarn', ['global', 'dir']) | ||
if (__dirname.includes(yarnGlobalDir)) { | ||
return 'yarn global add' | ||
} | ||
} | ||
|
||
if (hasPnpm3OrLater()) { | ||
const { stdout: pnpmGlobalPrefix } = execa.sync('pnpm', ['config', 'get', 'prefix']) | ||
if (__dirname.includes(pnpmGlobalPrefix) && __dirname.includes('pnpm-global')) { | ||
return `pnpm i -g` | ||
} | ||
} | ||
|
||
const { stdout: npmGlobalPrefix } = execa.sync('npm', ['config', 'get', 'prefix']) | ||
if (__dirname.includes(npmGlobalPrefix)) { | ||
return `npm i -g` | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters