Skip to content

Commit f5d025c

Browse files
committed
chore: fix release flow
1 parent 0098413 commit f5d025c

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Setup node.js
3030
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
3131
with:
32-
node-version: 20
32+
node-version: 24
3333
cache: pnpm
3434

3535
- name: Update npm

scripts/private.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* Check if a package is private
5+
* Usage: node scripts/private.ts <package-path>
6+
* Returns: "true" if package is private, "false" otherwise
7+
*/
8+
9+
import path from 'node:path'
10+
import { pathToFileURL } from 'node:url'
11+
12+
async function isPrivatePackage(packagePath: string): Promise<boolean> {
13+
try {
14+
const packageJsonPath = path.resolve(packagePath, 'package.json')
15+
const packageJsonUrl = pathToFileURL(packageJsonPath).href
16+
const packageJson = (
17+
(await import(packageJsonUrl, { with: { type: 'json' } })) as { default: { private?: true } }
18+
).default
19+
return packageJson.private === true
20+
} catch {
21+
// If package.json doesn't exist or can't be parsed, treat as non-private
22+
return false
23+
}
24+
}
25+
26+
const packagePath = process.argv[2]
27+
28+
if (!packagePath) {
29+
console.error('Error: Package path is required')
30+
console.error('Usage: node scripts/private.ts <package-path>')
31+
process.exit(1)
32+
}
33+
34+
const isPrivate = await isPrivatePackage(packagePath)
35+
console.log(isPrivate)

scripts/release.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ TAG="alpha"
1010
# Release packages for npm registry
1111
for PKG in packages/* ; do
1212
if [[ -d $PKG ]]; then
13+
# Check if package is private
14+
PRIVATE=$(pnpx tsx scripts/private.ts "$PKG")
15+
16+
if [[ "$PRIVATE" == "true" ]]; then
17+
echo "⏭️ Skipping $PKG (private package)"
18+
continue
19+
fi
20+
1321
pushd $PKG
1422
echo "⚡ Publishing $PKG with tag $TAG"
1523
pnpm publish --access public --no-git-checks --tag $TAG

0 commit comments

Comments
 (0)