Fix copying swc binary for isolated tests locally (#32026)

This commit is contained in:
JJ Kasper 2021-12-02 06:40:38 -06:00 committed by GitHub
parent 494e37c026
commit 03317c7507
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,15 +18,16 @@ async function createNextInstall(dependencies) {
)) {
if (folder.startsWith('swc-')) {
const swcPkgPath = path.join(origRepoDir, 'node_modules/@next', folder)
await fs.copy(
swcPkgPath,
path.join(origRepoDir, 'packages/next-swc/native'),
{
filter: (item) =>
const outputPath = path.join(origRepoDir, 'packages/next-swc/native')
await fs.copy(swcPkgPath, outputPath, {
filter: (item) => {
return (
item === swcPkgPath ||
(item.endsWith('.node') && !fs.pathExistsSync(item)),
}
)
(item.endsWith('.node') &&
!fs.pathExistsSync(path.join(outputPath, path.basename(item))))
)
},
})
}
}