@@ -916,7 +916,7 @@ const addPackageJson = async ({ project_root, answers }) => {
916916 "winston" ,
917917 "mongoose"
918918 ] ;
919- const devDependencies = [ "nodemon" , "jest" ] ;
919+ const devDependencies = [ "nodemon" , "jest" ] ;
920920 const configDependencies = [ 'dotenv' , 'joi' , 'morgan' , 'winston' ]
921921 const utilitiesDependencies = [ 'joi' ]
922922 // Join dependencies into a single string for the command
@@ -1250,12 +1250,11 @@ const generateMCSHelper = ({ project_root, answers }) => {
12501250 // Correct the file extension based on directory
12511251 const mcsPath = `${ project_root } /microservices/${ answers . service_name } /src/${ mcs } `
12521252 mkdirSync ( mcsPath , { recursive : true } )
1253- const fileExtension = mcs === 'models' ? 'model .js' : mcs === 'routes' ? 'routes.js' : 'controllers.js' ;
1253+ const fileExtension = ` ${ mcs } .js` ;
12541254
12551255 // Write main file content
1256- const mainContent = mcs === 'models' ? assets . modelContent ( ) : mcs === 'routes' ? assets . routesContent ( ) : mcs === 'controllers' ? assets . controllersContent ( { answers } ) : assets . servicesContent ( ) ;
1256+ const mainContent = mcs === 'models' ? assets . modelContent ( { answers } ) : mcs === 'routes' ? assets . routesContent ( { answers } ) : mcs === 'controllers' ? assets . controllersContent ( { answers } ) : assets . servicesContent ( { answers } ) ;
12571257 writeFileSync ( join ( mcsPath , `${ fileExtension } ` ) , mainContent ) ;
1258-
12591258 // Write index file content
12601259 const indexContent = mcs === 'models' ? assets . modelIndexContent ( ) : mcs === 'routes' ? assets . routesIndexContent ( ) : mcs === 'controllers' ? assets . controllersIndexContent ( ) : assets . servicesIndexContent ( ) ;
12611260 writeFileSync ( join ( mcsPath , 'index.js' ) , indexContent ) ;
@@ -1277,17 +1276,17 @@ const releasePackage = async ({ package }) => {
12771276 const { workspace_name } = retrieveWorkSpaceName ( { package_json_path } ) ;
12781277 if ( package ) {
12791278 logInfo ( { message : `Looking for package: ${ workspace_name } /${ package } ` } ) ;
1280- await executeCommand ( 'yarn' , [ 'workspace' , `${ workspace_name } /${ package } ` , 'release' ] , { stdio :'inherit' , shell :true } ) ;
1279+ await executeCommand ( 'yarn' , [ 'workspace' , `${ workspace_name } /${ package } ` , 'release' ] , { stdio : 'inherit' , shell : true } ) ;
12811280 } else {
1282- await executeCommand ( 'yarn' , [ 'generate:release' ] , { cwd : cwd ( ) , stdio :'inherit' , shell :true } ) ;
1281+ await executeCommand ( 'yarn' , [ 'generate:release' ] , { cwd : cwd ( ) , stdio : 'inherit' , shell : true } ) ;
12831282 }
12841283 } catch ( error ) {
1285- ora ( ) . fail ( 'Command failed to run' ) ;
1284+ ora ( ) . fail ( 'Command failed to run' ) ;
12861285 }
12871286}
12881287
1289- const executeCommand = ( command , args , options ) => {
1290- return new Promise ( async ( resolve , reject ) => {
1288+ const executeCommand = ( command , args , options ) => {
1289+ return new Promise ( async ( resolve , reject ) => {
12911290 const child = await spawn ( command , args , options ) ;
12921291 child . on ( 'close' , ( code ) => {
12931292 if ( code !== 0 ) {
0 commit comments