@@ -28,31 +28,27 @@ async function deployProject(run) {
28
28
*/
29
29
async function deployActions ( { run, functionsDir, timeout, memory} ) {
30
30
const files = await readdir ( functionsDir ) ;
31
- for ( const file of files ) {
32
- const [ actionName , extension ] = file . split ( '.' ) ;
33
- let command =
34
- `nim action update ${ actionName } ${ join ( functionsDir , file ) } ` +
35
- `--timeout=${ Number ( timeout ) } --memory=${ Number ( memory ) } ` +
36
- `--web=raw ` ;
37
-
38
- if ( extension === 'js' ) {
39
- command += '--kind nodejs-lambda:10 --main handler' ;
40
- }
41
31
42
- // Deploy
43
- console . log ( `Deploying ${ file } ...` ) ;
44
- // eslint-disable-next-line no-await-in-loop
45
- const { stdout, stderr, exitCode} = await run . command ( command , {
46
- reject : false ,
47
- stdout : 'ignore'
48
- } ) ;
49
-
50
- if ( exitCode === 0 ) {
51
- console . log ( 'done.' ) ;
52
- } else {
53
- console . log ( stdout || stderr ) ;
54
- }
55
- }
32
+ await Promise . all (
33
+ files . map ( async ( file ) => {
34
+ const [ actionName , extension ] = file . split ( '.' ) ;
35
+ let command =
36
+ `nim action update ${ actionName } ${ join ( functionsDir , file ) } ` +
37
+ `--timeout=${ Number ( timeout ) } --memory=${ Number ( memory ) } ` +
38
+ `--web=raw ` ;
39
+
40
+ if ( extension === 'js' ) {
41
+ command += '--kind nodejs-lambda:10 --main handler' ;
42
+ }
43
+
44
+ const { stderr, exitCode} = await run . command ( command , {
45
+ reject : false ,
46
+ stdout : 'ignore'
47
+ } ) ;
48
+ const message = exitCode === 0 ? 'done.' : String ( stderr ) ;
49
+ console . log ( `Deploying ${ file } : ${ message } ` ) ;
50
+ } )
51
+ ) ;
56
52
}
57
53
58
54
module . exports = {
0 commit comments