Skip to content

Commit

Permalink
Update publish to skip private package (#40822)
Browse files Browse the repository at this point in the history
Follow-up to #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
  • Loading branch information
ijjk committed Sep 23, 2022
1 parent 8e1256d commit f19241b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 0 additions & 3 deletions packages/font/package.json
Expand Up @@ -16,8 +16,5 @@
"prepublishOnly": "cd ../../ && turbo run build",
"dev": "tsc -d -w -p tsconfig.json",
"typescript": "tsec --noEmit -p tsconfig.json"
},
"publishConfig": {
"access": "public"
}
}
16 changes: 14 additions & 2 deletions scripts/publish-release.js
Expand Up @@ -4,11 +4,12 @@
const path = require('path')
const { readdir } = require('fs/promises')
const { execSync } = require('child_process')
const { readJson } = require('fs-extra')

const cwd = process.cwd()

;(async function () {
let isCanary = false
let isCanary = true

if (!process.env.NPM_TOKEN) {
console.log('No NPM_TOKEN, exiting...')
Expand All @@ -18,7 +19,10 @@ const cwd = process.cwd()
try {
const tagOutput = execSync('git describe --exact-match').toString()
console.log(tagOutput)
isCanary = tagOutput.includes('-canary')

if (tagOutput.trim().startsWith('v')) {
isCanary = tagOutput.includes('-canary')
}
} catch (err) {
console.log(err)

Expand Down Expand Up @@ -72,6 +76,14 @@ const cwd = process.cwd()
}

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)
}
})()

0 comments on commit f19241b

Please sign in to comment.