@@ -37,12 +37,13 @@ export function testStandaloneBuild(pkgDir) {
3737 // Pack core into tmp directory with unique name then install from package tarball
3838 const coreDir = path . join ( pkgDir , '..' , 'core' )
3939 const uniqueId = `${ Date . now ( ) } -${ Math . random ( ) . toString ( 36 ) . substring ( 7 ) } `
40- const tarballDir = os . tmpdir ( )
41- const packOutput = execSync ( `npm pack --pack-destination="${ tarballDir } "` , { cwd : coreDir , encoding : 'utf-8' } )
42- const tarballName = packOutput . trim ( ) . split ( '\n' ) . pop ( ) // Get last line (tarball filename)
43- const originalTarballPath = path . join ( tarballDir , tarballName )
44- coreTarballPath = path . join ( tarballDir , `cdc-core-${ uniqueId } .tgz` )
45- fs . renameSync ( originalTarballPath , coreTarballPath )
40+ const uniqueTarballDir = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , `cdc-pack-${ uniqueId } -` ) )
41+ const packOutput = execSync ( `npm pack --pack-destination="${ uniqueTarballDir } "` , {
42+ cwd : coreDir ,
43+ encoding : 'utf-8'
44+ } )
45+ const tarballName = packOutput . trim ( ) . split ( '\n' ) . pop ( )
46+ coreTarballPath = path . join ( uniqueTarballDir , tarballName )
4647 execSync ( `npm install "${ coreTarballPath } "` , { cwd : tmpDir , stdio : 'inherit' } )
4748
4849 execSync ( 'npm run build' , { cwd : tmpDir } )
@@ -53,7 +54,8 @@ export function testStandaloneBuild(pkgDir) {
5354 return false
5455 } finally {
5556 if ( coreTarballPath && fs . existsSync ( coreTarballPath ) ) {
56- fs . unlinkSync ( coreTarballPath )
57+ const uniqueTarballDir = path . dirname ( coreTarballPath )
58+ fs . rmSync ( uniqueTarballDir , { recursive : true , force : true } )
5759 }
5860 fs . rmSync ( tmpDir , { recursive : true , force : true } )
5961 }
0 commit comments