Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update publish to skip private package #40822

Merged
merged 1 commit into from Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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)
}
})()