Skip to content

Commit

Permalink
Use fallback SWC version when binary publish fails (#30568)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk authored Oct 28, 2021
1 parent 63024d3 commit d43e05c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion scripts/publish-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ const cwd = process.cwd()
let platforms = (await readdir(nativePackagesDir)).filter(
(name) => !name.startsWith('.')
)
const publishedPkgs = new Set()
// TODO: update to latest version where all pacakges were
// successfully published
const fallbackVersion = `12.0.1`

for (let platform of platforms) {
try {
let binaryName = `next-swc.${platform}.node`
Expand All @@ -42,6 +47,7 @@ const cwd = process.cwd()
gitref.includes('canary') ? ' --tag canary' : ''
}`
)
publishedPkgs.add(platform)
} catch (err) {
// don't block publishing other versions on single platform error
console.error(`Failed to publish`, platform, err)
Expand All @@ -62,7 +68,11 @@ const cwd = process.cwd()
)
for (let platform of platforms) {
let optionalDependencies = nextPkg.optionalDependencies || {}
optionalDependencies['@next/swc-' + platform] = version
optionalDependencies['@next/swc-' + platform] = publishedPkgs.has(
platform
)
? version
: fallbackVersion
nextPkg.optionalDependencies = optionalDependencies
}
await writeFile(
Expand Down

0 comments on commit d43e05c

Please sign in to comment.