Skip to content

Commit 2b39f58

Browse files
authored
refactor(create-app): detects pkgManager for run instructions (#1990)
1 parent 2a6109a commit 2b39f58

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/create-app/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,14 @@ async function init() {
111111
pkg.name = path.basename(root)
112112
write('package.json', JSON.stringify(pkg, null, 2))
113113

114+
const pkgManager = /yarn/.test(process.env.npm_execpath) ? 'yarn' : 'npm'
115+
114116
console.log(`\nDone. Now run:\n`)
115117
if (root !== cwd) {
116118
console.log(` cd ${path.relative(cwd, root)}`)
117119
}
118-
console.log(` npm install (or \`yarn\`)`)
119-
console.log(` npm run dev (or \`yarn dev\`)`)
120+
console.log(` ${pkgManager === 'yarn' ? `yarn` : `npm install`}`)
121+
console.log(` ${pkgManager === 'yarn' ? `yarn dev` : `npm run dev`}`)
120122
console.log()
121123
}
122124

0 commit comments

Comments
 (0)