1- #!/usr/bin/env node
1+ 'use strict' ;
22
33import inquirer from 'inquirer' ;
44import chalk from 'chalk' ;
@@ -51,7 +51,8 @@ async function setupProject() {
5151 {
5252 type : 'confirm' ,
5353 name : 'createEnvFile' ,
54- message : 'Do you want to create an .env file for your database configuration?' ,
54+ message :
55+ 'Do you want to create an .env file for your database configuration?' ,
5556 default : true ,
5657 } ,
5758 ] ) ;
@@ -62,7 +63,9 @@ async function setupProject() {
6263
6364 // Create project directory
6465 if ( fs . existsSync ( projectPath ) ) {
65- console . log ( chalk . red ( `Directory "${ projectName } " already exists! Exiting.` ) ) ;
66+ console . log (
67+ chalk . red ( `Directory "${ projectName } " already exists! Exiting.` )
68+ ) ;
6669 process . exit ( 1 ) ;
6770 }
6871 fs . mkdirSync ( projectPath ) ;
@@ -84,22 +87,22 @@ async function setupProject() {
8487 dev : 'node index.js' ,
8588 start : 'node index.js' ,
8689 format : 'prettier --write *.js' ,
87- lint : 'eslint *.js --fix'
90+ lint : 'eslint *.js --fix' ,
8891 } ,
8992 dependencies : { } ,
9093 devDependencies : {
91- " prettier" : " latest" ,
92- " eslint" : " latest"
94+ prettier : ' latest' ,
95+ eslint : ' latest' ,
9396 } ,
9497 type : 'module' ,
9598 keywords : [ ] ,
96- author : "" ,
97- license : " ISC" ,
99+ author : '' ,
100+ license : ' ISC' ,
98101 description : '' ,
99102 } ;
100103
101- dependencies [ framework ] . forEach ( dep => {
102- packageJson . dependencies [ dep ] = " latest" ; // Add framework dependencies
104+ dependencies [ framework ] . forEach ( ( dep ) => {
105+ packageJson . dependencies [ dep ] = ' latest' ; // Add framework dependencies
103106 } ) ;
104107
105108 fs . writeFileSync ( packageJsonPath , JSON . stringify ( packageJson , null , 2 ) ) ;
@@ -137,7 +140,10 @@ app.listen(3000, () => {
137140});
138141` ,
139142 } ;
140- fs . writeFileSync ( path . join ( projectPath , 'index.js' ) , boilerplate [ framework ] ) ;
143+ fs . writeFileSync (
144+ path . join ( projectPath , 'index.js' ) ,
145+ boilerplate [ framework ]
146+ ) ;
141147
142148 if ( addDatabase ) {
143149 const envContent = `
@@ -153,8 +159,11 @@ DB_NAME=database_name
153159
154160 // Git initialization
155161 if ( versionControl ) {
156- execSync ( `git init ${ projectName } > /dev/null 2>&1` )
157- fs . writeFileSync ( path . join ( projectPath , '.gitignore' ) , 'node_modules\n.env\n' ) ;
162+ execSync ( `git init ${ projectName } > /dev/null 2>&1` ) ;
163+ fs . writeFileSync (
164+ path . join ( projectPath , '.gitignore' ) ,
165+ 'node_modules\n.env\n'
166+ ) ;
158167 }
159168
160169 // Write Prettier configuration
@@ -184,7 +193,7 @@ DB_NAME=database_name
184193 semi : [ 'error' , 'always' ] ,
185194 } ,
186195 } ;
187-
196+
188197 fs . writeFileSync (
189198 path . join ( projectPath , '.prettierrc.json' ) ,
190199 JSON . stringify ( prettierConfig , null , 2 )
@@ -195,7 +204,7 @@ DB_NAME=database_name
195204 JSON . stringify ( eslintConfig , null , 2 )
196205 ) ;
197206
198- console . log ( chalk . white ( `\nScaffolding project in ${ projectPath } ` ) )
207+ console . log ( chalk . white ( `\nScaffolding project in ${ projectPath } ` ) ) ;
199208
200209 console . log ( `
201210Done. Now run:
0 commit comments