@@ -28,15 +28,26 @@ var archiver = require('archiver');
2828var  version  =  require ( './version.json' ) ; 
2929const  fetch  =  require ( 'node-fetch' ) ; 
3030const  { Octokit}  =  require ( '@octokit/rest' ) ; 
31- const  mkdirp  =  require ( 'mkdirp' ) 
3231const  extract  =  require ( 'extract-zip' ) 
33- const  { exec }  =  require ( 'child_process' ) ; 
32+ const  { execSync }  =  require ( 'child_process' ) ; 
3433const  rimraf  =  require ( 'rimraf' ) . sync ; 
3534
35+ function  pip ( pipDestination ,  extractedDirectory )  { 
36+   console . log ( 'PIP to:' ,  pipDestination ) ; 
37+   execSync ( 
38+       'python -m pip install --upgrade -r '  + 
39+           path . join ( 
40+               extractedDirectory , 
41+               'server/requirements.txt' )  + 
42+           ' -t '  +  pipDestination , 
43+           { stdio : 'inherit' } ) ; 
44+ } 
3645
3746const  dir  =  'GeodePackage'  + 
3847    '-'  +  process . argv [ 2 ]  +  '-'  +  process . argv [ 3 ] ; 
39- mkdirp . sync ( dir ) ; 
48+ fs . mkdirSync ( dir ) ; 
49+ const  pipDestination  =  path . join ( dir ,  'server' ) ; 
50+ fs . mkdirSync ( pipDestination ) ; 
4051const  owner  =  'Geode-solutions' 
4152
4253var  octokit  =  new  Octokit ( { auth : process . env . TOKEN } ) ; 
@@ -67,36 +78,17 @@ function getRelease(repo, version, isModule) {
6778                          extract ( outputFile ,  { 
6879                            dir : path . resolve ( outputDirectory ) 
6980                          } ) . then ( ( )  =>  { 
70-                             let  extractedDirectory  =  '' ; 
7181                            if  ( isModule )  { 
72-                                 const  extractedName  =  asset . name . slice ( 0 ,  - 4 ) ; 
73-                                 extractedDirectory  = 
74-                                     path . join ( outputDirectory ,  repo ) ; 
75-                                 rimraf ( extractedDirectory ) ; 
76-                                 fs . renameSync ( 
77-                                     path . join ( outputDirectory ,  extractedName ) , 
78-                                     extractedDirectory ) ; 
79-                               } 
80-                             else  { 
81-                               extractedDirectory  =  dir ; 
82+                               const  extractedName  =  asset . name . slice ( 0 ,  - 4 ) ; 
83+                               const  extractedDirectory  = 
84+                                   path . join ( outputDirectory ,  repo ) ; 
85+                               rimraf ( extractedDirectory ) ; 
86+                               fs . renameSync ( 
87+                                   path . join ( outputDirectory ,  extractedName ) , 
88+                                   extractedDirectory ) ; 
8289                            } 
8390                            console . log ( 'Unzip to:' ,  repo ) ; 
84-                             const  pipDestination  =  path . join ( dir ,  'server' ) ; 
85-                             if  ( ! fs . existsSync ( pipDestination ) )  { 
86-                               fs . mkdirSync ( pipDestination ) ; 
87-                             } 
88-                             console . log ( 'PIP to:' ,  pipDestination ) ; 
89-                             exec ( 
90-                                 'python -m pip install --upgrade -r '  + 
91-                                     path . join ( 
92-                                         extractedDirectory , 
93-                                         'server/requirements.txt' )  + 
94-                                     ' -t '  +  pipDestination , 
95-                                 ( err ,  stdout ,  stderr )  =>  { 
96-                                   console . log ( `stdout: ${ stdout }  ` ) ; 
97-                                   console . log ( `stderr: ${ stderr }  ` ) ; 
98-                                   resolve ( ) ; 
99-                                 } ) ; 
91+                             resolve ( ) ; 
10092                          } ) ; 
10193                        }  catch  ( error )  { 
10294                          reject ( error ) ; 
@@ -123,6 +115,12 @@ for (let [repo, tag] of Object.entries(version.modules)) {
123115fs . writeFileSync ( path . join ( dir ,  'config.json' ) ,  JSON . stringify ( config ) ) ; 
124116
125117Promise . all ( promises ) . then ( ( )  =>  { 
118+   pip ( pipDestination ,  dir ) ; 
119+   for  ( let  [ repo ,  tag ]  of  Object . entries ( version . modules ) )  { 
120+     const  repoGeode  =  repo . concat ( '.geode' ) ; 
121+     pip ( pipDestination ,  path . join ( dir ,  'modules' ,  repoGeode ) ) ; 
122+   } 
123+ 
126124  // create a file to stream archive data to. 
127125  const  outputName  =  path . join ( __dirname ,  dir  +  '.zip' ) ; 
128126  console . log ( 'Output: ' ,  outputName ) ; 
0 commit comments