@@ -33,6 +33,7 @@ const {
3333 hasGit,
3434 hasProjectGit,
3535 hasYarn,
36+ hasPnpm,
3637 logWithSpinner,
3738 stopSpinner,
3839 exit,
@@ -97,7 +98,8 @@ module.exports = class Creator extends EventEmitter {
9798 const packageManager = (
9899 cliOptions . packageManager ||
99100 loadOptions ( ) . packageManager ||
100- ( hasYarn ( ) ? 'yarn' : 'npm' )
101+ ( hasYarn ( ) ? 'yarn' : null ) ||
102+ ( hasPnpm ( ) ? 'pnpm' : 'npm' )
101103 )
102104
103105 await clearConsole ( )
@@ -214,7 +216,7 @@ module.exports = class Creator extends EventEmitter {
214216 log (
215217 `👉 Get started with the following commands:\n\n` +
216218 ( this . context === process . cwd ( ) ? `` : chalk . cyan ( ` ${ chalk . gray ( '$' ) } cd ${ name } \n` ) ) +
217- chalk . cyan ( ` ${ chalk . gray ( '$' ) } ${ packageManager === 'yarn' ? 'yarn serve' : 'npm run serve' } ` )
219+ chalk . cyan ( ` ${ chalk . gray ( '$' ) } ${ packageManager === 'yarn' ? 'yarn serve' : packageManager === 'pnpm' ? 'pnpm run serve' : 'npm run serve' } ` )
218220 )
219221 }
220222 log ( )
@@ -410,23 +412,36 @@ module.exports = class Creator extends EventEmitter {
410412
411413 // ask for packageManager once
412414 const savedOptions = loadOptions ( )
413- if ( ! savedOptions . packageManager && hasYarn ( ) ) {
415+ if ( ! savedOptions . packageManager && ( hasYarn ( ) || hasPnpm ( ) ) ) {
416+ const packageManagerChoices = [ ]
417+
418+ if ( hasYarn ( ) ) {
419+ packageManagerChoices . push ( {
420+ name : 'Use Yarn' ,
421+ value : 'yarn' ,
422+ short : 'Yarn'
423+ } )
424+ }
425+
426+ if ( hasPnpm ( ) ) {
427+ packageManagerChoices . push ( {
428+ name : 'Use PNPM' ,
429+ value : 'pnpm' ,
430+ short : 'PNPM'
431+ } )
432+ }
433+
434+ packageManagerChoices . push ( {
435+ name : 'Use NPM' ,
436+ value : 'npm' ,
437+ short : 'NPM'
438+ } )
439+
414440 outroPrompts . push ( {
415441 name : 'packageManager' ,
416442 type : 'list' ,
417443 message : 'Pick the package manager to use when installing dependencies:' ,
418- choices : [
419- {
420- name : 'Use Yarn' ,
421- value : 'yarn' ,
422- short : 'Yarn'
423- } ,
424- {
425- name : 'Use NPM' ,
426- value : 'npm' ,
427- short : 'NPM'
428- }
429- ]
444+ choices : packageManagerChoices
430445 } )
431446 }
432447
0 commit comments