File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -214,19 +214,17 @@ export async function setupInlineFixture(options: {
214214 // write additional files
215215 if ( options . files ) {
216216 for ( let [ filename , contents ] of Object . entries ( options . files ) ) {
217+ const filepath = path . join ( options . dest , filename )
218+ fs . mkdirSync ( path . dirname ( filepath ) , { recursive : true } )
219+
217220 // custom command
218221 if ( typeof contents === 'object' && 'cp' in contents ) {
219222 const srcFile = path . join ( options . dest , contents . cp )
220- const destFile = path . join ( options . dest , filename )
221- fs . mkdirSync ( path . dirname ( srcFile ) , { recursive : true } )
222- fs . mkdirSync ( path . dirname ( destFile ) , { recursive : true } )
223- fs . cpSync ( srcFile , destFile , { recursive : true } )
223+ fs . cpSync ( srcFile , filepath , { recursive : true } )
224224 continue
225225 }
226- // write a file
227- const filepath = path . join ( options . dest , filename )
228- fs . mkdirSync ( path . dirname ( filepath ) , { recursive : true } )
229- // strip indent
226+
227+ // write a new file
230228 contents = contents . replace ( / ^ \n * / , '' ) . replace ( / \s * $ / , '\n' )
231229 const indent = contents . match ( / ^ \s * / ) ?. [ 0 ] ?? ''
232230 const strippedContents = contents
You can’t perform that action at this time.
0 commit comments