File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed
packages/wrangler/e2e/helpers Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -14,19 +14,21 @@ export async function seed(
1414 files : Record < string , string | Uint8Array >
1515) {
1616 // TODO(someday): allow copying/symlinking file/directory paths in seed? like "path`${__dirname}/../fixture`"?
17- for ( const [ name , contents ] of Object . entries ( files ) ) {
18- const filePath = path . resolve ( root , name ) ;
19- await mkdir ( path . dirname ( filePath ) , { recursive : true } ) ;
20- await writeFile ( filePath , contents ) ;
21- }
17+ await Promise . all (
18+ Object . entries ( files ) . map ( async ( [ name , contents ] ) => {
19+ const filePath = path . resolve ( root , name ) ;
20+ await mkdir ( path . dirname ( filePath ) , { recursive : true } ) ;
21+ await writeFile ( filePath , contents ) ;
22+ } )
23+ ) ;
2224}
2325
2426// Removes the given files from the `root` directory on the file system.
2527export async function removeFiles ( root : string , files : string [ ] ) {
26- for ( const name of files ) {
27- const filePath = path . resolve ( root , name ) ;
28- if ( filePath ) {
29- await rm ( filePath ) ;
30- }
31- }
28+ await Promise . all (
29+ files . map ( async ( name ) => {
30+ const filePath = path . resolve ( root , name ) ;
31+ await rm ( filePath , { force : true } ) ;
32+ } )
33+ ) ;
3234}
You can’t perform that action at this time.
0 commit comments