@@ -39,33 +39,32 @@ const moduleConfigFilePath = async (moduleName='*') => {
3939} ;
4040
4141const createArchive = async ( moduleName ) => {
42+ if ( ! fs . existsSync ( moduleConfigFileName ) && ! fs . existsSync ( `modules/${ moduleName } /` ) ) {
43+ throw new Error ( `There is no directory modules/${ moduleName } - please double check the machine_name property in ${ filePath } ` ) ;
44+ }
45+
4246 const archive = prepareArchive ( archivePath , true ) ;
4347
4448 if ( fs . existsSync ( moduleConfigFileName ) && ! fs . existsSync ( 'modules/' ) ) {
4549 logger . Warn ( `Cannot find modules/${ moduleName } , creating archive with the current directory.` ) ;
4650 const moduleFiles = await glob ( [ '**/**' , moduleConfigFileName ] , {
4751 ignore : [ '**/node_modules/**' , '**/tmp/**' , 'app/**' ] ,
48- onlyFiles : true ,
49- dot : true
52+ onlyFiles : true
5053 } ) ;
5154 for ( const f of moduleFiles ) {
5255 archive . addFile ( f , `${ moduleName } /${ f } ` ) ;
5356 }
54- } else if ( fs . existsSync ( `modules/ ${ moduleName } /` ) ) {
57+ } else {
5558 logger . Info ( `Creating archive for modules/${ moduleName } ` ) ;
5659 const moduleDir = path . join ( process . cwd ( ) , 'modules' , moduleName ) ;
5760 const moduleFiles = await glob ( [ '**/**' , moduleConfigFileName ] , {
5861 ignore : [ '**/node_modules/**' , '**/tmp/**' ] ,
5962 cwd : moduleDir ,
60- onlyFiles : true ,
61- dot : true
63+ onlyFiles : true
6264 } ) ;
6365 for ( const f of moduleFiles ) {
6466 archive . addFile ( path . join ( 'modules' , moduleName , f ) , `${ moduleName } /${ f } ` ) ;
6567 }
66- } else {
67- archive . finalize ( ) ;
68- throw new Error ( `There is no directory modules/${ moduleName } - please double check the machine_name property in ${ filePath } ` ) ;
6968 }
7069
7170 archive . finalize ( ) ;
0 commit comments