File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,15 @@ class Git {
6060 config = ( prop : string , value : string ) =>
6161 this . exec ( `config ${ prop } "${ value } "` ) ;
6262
63- add = ( file : string ) => this . exec ( `add ${ file } ` ) ;
63+ add = ( file : string | string [ ] ) => {
64+ let str = '' ;
65+ if ( Array . isArray ( file ) ) {
66+ file . map ( ( f ) => ( str += ` ${ f } ` ) ) ;
67+ } else {
68+ str = file ;
69+ }
70+ return this . exec ( `add ${ str } ` ) ;
71+ } ;
6472
6573 commit = ( message : string ) => this . exec ( `commit -m "${ message } "` ) ;
6674
Original file line number Diff line number Diff line change @@ -129,12 +129,10 @@ export async function pushNewFiles(files: File[] = []): Promise<any> {
129129 await git . pull ( ) ;
130130
131131 await Promise . all (
132- files . map ( async ( { filename, data } ) => {
133- await fsp . writeFile ( filename , data ) ;
134- await git . add ( filename ) ;
135- } )
132+ files . map ( ( { filename, data } ) => fsp . writeFile ( filename , data ) )
136133 ) ;
137134
135+ await git . add ( files . map ( ( { filename } ) => filename ) ) ;
138136 await git . commit ( `chore(updates): updated entries in files` ) ;
139137 await git . push ( ) ;
140138}
You can’t perform that action at this time.
0 commit comments