Commit da73555f authored by JJ Kasper's avatar JJ Kasper

lock swc binaries version

parent a4e7a948
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
const path = require('path') const path = require('path')
const { readFile, readdir, writeFile } = require('fs/promises') const { readFile, readdir, writeFile } = require('fs/promises')
const { copy } = require('fs-extra') // const { copy } = require('fs-extra')
const { execSync } = require('child_process') const { execSync } = require('child_process')
const cwd = process.cwd() const cwd = process.cwd()
...@@ -12,6 +12,7 @@ const cwd = process.cwd() ...@@ -12,6 +12,7 @@ const cwd = process.cwd()
let version = JSON.parse( let version = JSON.parse(
await readFile(path.join(cwd, 'lerna.json')) await readFile(path.join(cwd, 'lerna.json'))
).version ).version
let lockedNativeVersion = '12.3.4'
let gitref = process.argv.slice(2)[0] let gitref = process.argv.slice(2)[0]
// Copy binaries to package folders, update version, and publish // Copy binaries to package folders, update version, and publish
...@@ -25,46 +26,46 @@ const cwd = process.cwd() ...@@ -25,46 +26,46 @@ const cwd = process.cwd()
for (let platform of platforms) { for (let platform of platforms) {
try { try {
let binaryName = `next-swc.${platform}.node` // let binaryName = `next-swc.${platform}.node`
await copy( // await copy(
path.join(cwd, 'packages/next-swc/native', binaryName), // path.join(cwd, 'packages/next-swc/native', binaryName),
path.join(nativePackagesDir, platform, binaryName) // path.join(nativePackagesDir, platform, binaryName)
) // )
let pkg = JSON.parse( // let pkg = JSON.parse(
await readFile(path.join(nativePackagesDir, platform, 'package.json')) // await readFile(path.join(nativePackagesDir, platform, 'package.json'))
) // )
pkg.version = version // pkg.version = version
await writeFile( // await writeFile(
path.join(nativePackagesDir, platform, 'package.json'), // path.join(nativePackagesDir, platform, 'package.json'),
JSON.stringify(pkg, null, 2) // JSON.stringify(pkg, null, 2)
) // )
execSync( // execSync(
`npm publish ${path.join( // `npm publish ${path.join(
nativePackagesDir, // nativePackagesDir,
platform // platform
)} --access public ${ // )} --access public ${
gitref.includes('canary') // gitref.includes('canary')
? ' --tag next-12-3-2' // ? ' --tag next-12-3-2'
: '--tag next-12-3-2' // : '--tag next-12-3-2'
}` // }`
) // )
let optionalDependencies = nextPkg.optionalDependencies || {} let optionalDependencies = nextPkg.optionalDependencies || {}
optionalDependencies['@next/swc-' + platform] = version optionalDependencies['@next/swc-' + platform] = lockedNativeVersion
nextPkg.optionalDependencies = optionalDependencies nextPkg.optionalDependencies = optionalDependencies
} catch (err) { } catch (err) {
// don't block publishing other versions on single platform error // // don't block publishing other versions on single platform error
console.error(`Failed to publish`, platform) // console.error(`Failed to publish`, platform)
// throw err // // throw err
} }
// lerna publish in next step will fail if git status is not clean // lerna publish in next step will fail if git status is not clean
execSync( // execSync(
`git update-index --skip-worktree ${path.join( // `git update-index --skip-worktree ${path.join(
nativePackagesDir, // nativePackagesDir,
platform, // platform,
'package.json' // 'package.json'
)}` // )}`
) // )
} }
// Update name/version of wasm packages and publish // Update name/version of wasm packages and publish
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment