Unverified Commit f19241bf authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Update publish to skip private package (#40822)

Follow-up to https://github.com/vercel/next.js/pull/40815 ensures we
skip attempting to publish private packages like `next-swc`

x-ref:
https://github.com/vercel/next.js/actions/runs/3109438515/jobs/5039954716
parent 8e1256d0
...@@ -16,8 +16,5 @@ ...@@ -16,8 +16,5 @@
"prepublishOnly": "cd ../../ && turbo run build", "prepublishOnly": "cd ../../ && turbo run build",
"dev": "tsc -d -w -p tsconfig.json", "dev": "tsc -d -w -p tsconfig.json",
"typescript": "tsec --noEmit -p tsconfig.json" "typescript": "tsec --noEmit -p tsconfig.json"
},
"publishConfig": {
"access": "public"
} }
} }
...@@ -4,11 +4,12 @@ ...@@ -4,11 +4,12 @@
const path = require('path') const path = require('path')
const { readdir } = require('fs/promises') const { readdir } = require('fs/promises')
const { execSync } = require('child_process') const { execSync } = require('child_process')
const { readJson } = require('fs-extra')
const cwd = process.cwd() const cwd = process.cwd()
;(async function () { ;(async function () {
let isCanary = false let isCanary = true
if (!process.env.NPM_TOKEN) { if (!process.env.NPM_TOKEN) {
console.log('No NPM_TOKEN, exiting...') console.log('No NPM_TOKEN, exiting...')
...@@ -18,7 +19,10 @@ const cwd = process.cwd() ...@@ -18,7 +19,10 @@ const cwd = process.cwd()
try { try {
const tagOutput = execSync('git describe --exact-match').toString() const tagOutput = execSync('git describe --exact-match').toString()
console.log(tagOutput) console.log(tagOutput)
if (tagOutput.trim().startsWith('v')) {
isCanary = tagOutput.includes('-canary') isCanary = tagOutput.includes('-canary')
}
} catch (err) { } catch (err) {
console.log(err) console.log(err)
...@@ -72,6 +76,14 @@ const cwd = process.cwd() ...@@ -72,6 +76,14 @@ const cwd = process.cwd()
} }
for (const packageDir of packageDirs) { for (const packageDir of packageDirs) {
const pkgJson = await readJson(
path.join(packagesDir, packageDir, 'package.json')
)
if (pkgJson.private) {
console.log(`Skipping private package ${packageDir}`)
continue
}
await publish(packageDir) await publish(packageDir)
} }
})() })()
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