1
1
import fg from 'fast-glob' ;
2
- import fs from 'fs-extra' ;
2
+ import fs from 'fs/promises' ;
3
+ import fsExtra from 'fs-extra' ;
3
4
import createIgnore , { Ignore as SingleFileIgnore } from 'ignore' ;
4
5
import path from 'path' ;
5
6
@@ -36,10 +37,10 @@ export class Ignore {
36
37
37
38
public async initIgnoreAsync ( ) : Promise < void > {
38
39
const easIgnorePath = path . join ( this . rootDir , EASIGNORE_FILENAME ) ;
39
- if ( await fs . pathExists ( easIgnorePath ) ) {
40
+ if ( await fsExtra . pathExists ( easIgnorePath ) ) {
40
41
this . ignoreMapping = [
41
42
[ '' , createIgnore ( ) . add ( DEFAULT_IGNORE ) ] ,
42
- [ '' , createIgnore ( ) . add ( await fs . readFile ( easIgnorePath , 'utf-8' ) ) ] ,
43
+ [ '' , createIgnore ( ) . add ( await fsExtra . readFile ( easIgnorePath , 'utf-8' ) ) ] ,
43
44
] ;
44
45
return ;
45
46
}
@@ -57,7 +58,7 @@ export class Ignore {
57
58
ignoreFilePaths . map ( async filePath => {
58
59
return [
59
60
filePath . slice ( 0 , filePath . length - GITIGNORE_FILENAME . length ) ,
60
- createIgnore ( ) . add ( await fs . readFile ( path . join ( this . rootDir , filePath ) , 'utf-8' ) ) ,
61
+ createIgnore ( ) . add ( await fsExtra . readFile ( path . join ( this . rootDir , filePath ) , 'utf-8' ) ) ,
61
62
] as const ;
62
63
} )
63
64
) ;
@@ -77,7 +78,10 @@ export class Ignore {
77
78
export async function makeShallowCopyAsync ( src : string , dst : string ) : Promise < void > {
78
79
const ignore = new Ignore ( src ) ;
79
80
await ignore . initIgnoreAsync ( ) ;
80
- await fs . copy ( src , dst , {
81
+ await fs . cp ( src , dst , {
82
+ recursive : true ,
83
+ // Preserve symlinks without re-resolving them to their original targets
84
+ verbatimSymlinks : true ,
81
85
filter : ( srcFilePath : string ) => {
82
86
if ( srcFilePath === src ) {
83
87
return true ;
0 commit comments