Unverified Commit 588a9c10 authored by Jan Kaifer's avatar Jan Kaifer Committed by GitHub

migrate from yarn to pnpm (#45652)

parent 12e41754
...@@ -137,7 +137,7 @@ module.exports = (actionInfo) => { ...@@ -137,7 +137,7 @@ module.exports = (actionInfo) => {
if (!pkgData.files) { if (!pkgData.files) {
pkgData.files = [] pkgData.files = []
} }
pkgData.files.push('native') pkgData.files.push('native/*')
require('console').log( require('console').log(
'using swc binaries: ', 'using swc binaries: ',
await exec(`ls ${path.join(path.dirname(pkgDataPath), 'native')}`) await exec(`ls ${path.join(path.dirname(pkgDataPath), 'native')}`)
...@@ -154,11 +154,18 @@ module.exports = (actionInfo) => { ...@@ -154,11 +154,18 @@ module.exports = (actionInfo) => {
pkgData.dependencies['@next/swc'] = pkgData.dependencies['@next/swc'] =
pkgDatas.get('@next/swc').packedPkgPath pkgDatas.get('@next/swc').packedPkgPath
} else { } else {
pkgData.files.push('native') pkgData.files.push('native/*')
} }
} }
} }
if (pkgData?.scripts?.prepublishOnly) {
// There's a bug in `pnpm pack` where it will run
// the prepublishOnly script and that will fail.
// See https://github.com/pnpm/pnpm/issues/2941
delete pkgData.scripts.prepublishOnly
}
await fs.writeFile( await fs.writeFile(
pkgDataPath, pkgDataPath,
JSON.stringify(pkgData, null, 2), JSON.stringify(pkgData, null, 2),
...@@ -170,11 +177,19 @@ module.exports = (actionInfo) => { ...@@ -170,11 +177,19 @@ module.exports = (actionInfo) => {
// to the correct versions // to the correct versions
await Promise.all( await Promise.all(
Array.from(pkgDatas.keys()).map(async (pkgName) => { Array.from(pkgDatas.keys()).map(async (pkgName) => {
const { pkg, pkgPath } = pkgDatas.get(pkgName) const { pkg, pkgPath, pkgData, packedPkgPath } =
await exec( pkgDatas.get(pkgName)
`cd ${pkgPath} && yarn pack -f '${pkg}-packed.tgz'`, // Copied from pnpm source: https://github.com/pnpm/pnpm/blob/5a5512f14c47f4778b8d2b6d957fb12c7ef40127/releasing/plugin-commands-publishing/src/pack.ts#L96
true const tmpTarball = path.join(
pkgPath,
`${pkgData.name.replace('@', '').replace('/', '-')}-${
pkgData.version
}.tgz`
) )
await execa('pnpm', ['pack'], {
cwd: pkgPath,
})
await fs.copyFile(tmpTarball, packedPkgPath)
}) })
) )
......
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