@@ -50,7 +50,7 @@ export interface AfterHookOptions {
5050 command : string ,
5151 options ?: CommonOptions < string >
5252 ) => ExecaChildProcess < string > ;
53- installNpmPackage : ( packageName : string ) => Promise < void > ;
53+ installNpmPackage : ( packageName : string , isDev ?: boolean ) => Promise < void > ;
5454}
5555
5656export enum NodePM {
@@ -89,40 +89,39 @@ async function getYargsOptions(
8989 interactive : { default : true } ,
9090 description : {
9191 type : 'input' ,
92- describe : 'description ' ,
92+ describe : 'Description ' ,
9393 default : 'description' ,
9494 prompt : 'if-no-arg' ,
9595 } ,
9696 author : {
9797 type : 'input' ,
98- describe : 'author name' ,
98+ describe : 'Author name' ,
9999 default : gitUser . name ,
100100 prompt : 'if-no-arg' ,
101101 } ,
102102 email : {
103103 type : 'input' ,
104- describe : 'author email' ,
104+ describe : 'Author email' ,
105105 default : gitUser . email ,
106106 prompt : 'if-no-arg' ,
107107 } ,
108108 template : {
109109 type : 'list' ,
110- describe : 'template ' ,
110+ describe : 'Template ' ,
111111 default : 'default' ,
112112 prompt : askForTemplate ? 'if-no-arg' : 'never' ,
113113 choices : availableTemplates ,
114114 } ,
115115 license : {
116116 type : 'list' ,
117- describe : 'license ' ,
117+ describe : 'License ' ,
118118 choices : [ ...availableLicenses ( ) , 'UNLICENSED' ] ,
119119 default : promptForLicense ? 'MIT' : 'UNLICENSED' ,
120120 prompt : promptForLicense ? 'if-no-arg' : 'never' ,
121121 } ,
122122 'node-pm' : {
123123 type : 'list' ,
124- describe :
125- 'select package manager to use for installing packages from npm' ,
124+ describe : 'package manager to use for installing packages from npm' ,
126125 choices : [ 'npm' , 'yarn' , 'pnpm' ] ,
127126 default : undefined , // undefined by default, we'll try to guess pm manager later
128127 prompt : promptForNodePM ? 'if-no-arg' : 'never' ,
@@ -225,10 +224,19 @@ export async function create(appName: string, options: Options) {
225224 // do not generate LICENSE
226225 }
227226
227+ const run = ( command : string , options : CommonOptions < string > = { } ) => {
228+ const args = command . split ( ' ' ) ;
229+ return execa ( args [ 0 ] , args . slice ( 1 ) , {
230+ stdio : 'inherit' ,
231+ cwd : packageDir ,
232+ ...options ,
233+ } ) ;
234+ } ;
235+
228236 // init git
229- const skipGit = args [ 'skip-git' ] ;
230237
231238 // init git if option skipGitInit or arg --skip-git are not set
239+ const skipGit = args [ 'skip-git' ] ;
232240 if ( ! ( options . skipGitInit || skipGit ) ) {
233241 try {
234242 console . log ( '\nInitializing a git repository' ) ;
@@ -239,17 +247,11 @@ export async function create(appName: string, options: Options) {
239247 }
240248 }
241249
242- const run = ( command : string , options : CommonOptions < string > = { } ) => {
243- const args = command . split ( ' ' ) ;
244- return execa ( args [ 0 ] , args . slice ( 1 ) , {
245- stdio : 'inherit' ,
246- cwd : packageDir ,
247- ...options ,
248- } ) ;
249- } ;
250-
251250 // run Node.js related tasks (only if `package.json` does exist in the template root)
252- let installNpmPackage = async ( packageName : string ) : Promise < void > => { } ;
251+ let installNpmPackage = async (
252+ pkg : string ,
253+ isDev ?: boolean
254+ ) : Promise < void > => { } ;
253255
254256 if ( exists ( 'package.json' , packageDir ) ) {
255257 const nodePMArg = args [ 'node-pm' ] ;
@@ -267,16 +269,14 @@ export async function create(appName: string, options: Options) {
267269 pkg : string | string [ ] ,
268270 isDev : boolean = false
269271 ) : Promise < void > => {
270- await addDeps ( {
271- rootDir : packageDir ,
272- deps : Array . isArray ( pkg ) ? pkg : [ pkg ] ,
272+ await addDeps ( packageDir , Array . isArray ( pkg ) ? pkg : [ pkg ] , {
273273 isDev,
274274 pm : packageManager ,
275275 } ) ;
276276 } ;
277277 }
278278
279- const afterHookOptions = {
279+ const afterHookOptions : AfterHookOptions = {
280280 name,
281281 packageDir,
282282 template,
0 commit comments