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 11'use strict' ;
22
3- import { copyFile , readdir , stat } from 'node:fs/promises' ;
3+ import { statSync , constants } from 'node:fs' ;
4+ import { copyFile , readdir } from 'node:fs/promises' ;
45import { join } from 'node:path' ;
56
67/**
@@ -17,17 +18,17 @@ export async function safeCopy(srcDir, targetDir) {
1718 const sourcePath = join ( srcDir , file ) ;
1819 const targetPath = join ( targetDir , file ) ;
1920
20- const tStat = await stat ( targetPath ) . catch ( ( ) => undefined ) ;
21+ const tStat = statSync ( targetPath , { throwIfNoEntry : false } ) ;
2122
2223 if ( tStat === undefined ) {
23- await copyFile ( sourcePath , targetPath ) ;
24+ await copyFile ( sourcePath , targetPath , constants . COPYFILE_FICLONE ) ;
2425 continue ;
2526 }
2627
27- const sStat = await stat ( sourcePath ) ;
28+ const sStat = statSync ( sourcePath ) ;
2829
2930 if ( sStat . size !== tStat . size || sStat . mtimeMs > tStat . mtimeMs ) {
30- await copyFile ( sourcePath , targetPath ) ;
31+ await copyFile ( sourcePath , targetPath , constants . COPYFILE_FICLONE ) ;
3132 }
3233 }
3334}
You can’t perform that action at this time.
0 commit comments