File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
src/generators/legacy-html/utils Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -14,21 +14,22 @@ import { join } from 'node:path';
1414export async function safeCopy ( srcDir , targetDir ) {
1515 const files = await readdir ( srcDir ) ;
1616
17- for ( const file of files ) {
17+ const promises = files . map ( file => {
1818 const sourcePath = join ( srcDir , file ) ;
1919 const targetPath = join ( targetDir , file ) ;
2020
2121 const tStat = statSync ( targetPath , { throwIfNoEntry : false } ) ;
2222
2323 if ( tStat === undefined ) {
24- await copyFile ( sourcePath , targetPath , constants . COPYFILE_FICLONE ) ;
25- continue ;
24+ return copyFile ( sourcePath , targetPath , constants . COPYFILE_FICLONE ) ;
2625 }
2726
2827 const sStat = statSync ( sourcePath ) ;
2928
3029 if ( sStat . size !== tStat . size || sStat . mtimeMs > tStat . mtimeMs ) {
31- await copyFile ( sourcePath , targetPath , constants . COPYFILE_FICLONE ) ;
30+ return copyFile ( sourcePath , targetPath , constants . COPYFILE_FICLONE ) ;
3231 }
33- }
32+ } ) ;
33+
34+ await Promise . all ( promises ) ;
3435}
You can’t perform that action at this time.
0 commit comments