We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bee0fe3 commit 27374f0Copy full SHA for 27374f0
index.js
@@ -358,12 +358,8 @@ async function init() {
358
// Supported package managers: pnpm > yarn > npm
359
// Note: until <https://github.com/pnpm/pnpm/issues/3505> is resolved,
360
// it is not possible to tell if the command is called by `pnpm init`.
361
- const packageManagerBinary = path.basename(process.env.npm_execpath || '')
362
- const packageManager = /pnpm/.test(packageManagerBinary)
363
- ? 'pnpm'
364
- : /yarn/.test(packageManagerBinary)
365
- ? 'yarn'
366
- : 'npm'
+ const userAgent = process.env.npm_config_user_agent ?? ''
+ const packageManager = /pnpm/.test(userAgent) ? 'pnpm' : /yarn/.test(userAgent) ? 'yarn' : 'npm'
367
368
// README generation
369
fs.writeFileSync(
0 commit comments