Repository navigation
fix(release): publish bun-packed tarball with npm (reliable CI auth) - #27
Conversation
`bun publish` ignores ~/.npmrc in CI and fails with "missing authentication" (oven-sh/bun#24124), so the publish job errored despite a valid NPM_TOKEN. Keep bun for packing — it resolves `workspace:*` to concrete versions — but upload the resulting tarball with `npm publish <tarball> --access public`, which reads the token from ~/.npmrc reliably. The packed manifest is already resolved, so npm never encounters a workspace: range. Idempotency, the workspace-range guard, and the `New tag:` markers are unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AwrAKRmfpXZnTp7M57V6u9
Walkthrough
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5daa333057
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const { tarball, cleanup } = packResolved(dir, name); | ||
| try { | ||
| console.log(`▲ publishing ${name}@${version}`); | ||
| execFileSync('npm', ['publish', tarball, '--access', 'public'], { stdio: 'inherit' }); |
There was a problem hiding this comment.
Reject stale workspace versions before publishing
When this path publishes the tarball produced by bun pm pack, packages with workspace deps inherit the checked-in bun.lock workspace versions, which are still 0.0.0 even though the package manifests are 0.1.0; I confirmed by packing packages/core, whose tarball manifest contains "@otomatty/tokens": "0.0.0". Because this line now uploads that tarball directly, @otomatty/core@0.1.0 and the React packages will depend on non-existent/old @otomatty/*@0.0.0 versions, so consumer installs can fail even though the workspace: string guard passes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
scripts/publish.ts (1)
96-99: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winpack失敗時の
stderrを握り潰さない方が、CIでの原因調査が容易になります。
npm publish側はstdio: 'inherit'ですが、こちらはstdio: 'ignore'のためbun pm packが失敗しても標準エラー出力が表示されず、execFileSyncの汎用エラーしか残りません。少なくとも stderr は親プロセスへ流すことを検討してください。♻️ stderr を表示する変更案
execFileSync('bun', ['pm', 'pack', '--quiet', '--destination', out], { cwd: dir, - stdio: 'ignore', + stdio: ['ignore', 'ignore', 'inherit'], });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/publish.ts` around lines 96 - 99, The execFileSync call for the bun pm pack command is suppressing all output with stdio: 'ignore', which makes it difficult to diagnose failures in CI environments. To improve debuggability and align with the npm publish call above which uses stdio: 'inherit', change the stdio option in the execFileSync call for bun pm pack from 'ignore' to 'inherit' so that stderr output from the pack operation is visible to the parent process.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@scripts/publish.ts`:
- Around line 96-99: The execFileSync call for the bun pm pack command is
suppressing all output with stdio: 'ignore', which makes it difficult to
diagnose failures in CI environments. To improve debuggability and align with
the npm publish call above which uses stdio: 'inherit', change the stdio option
in the execFileSync call for bun pm pack from 'ignore' to 'inherit' so that
stderr output from the pack operation is visible to the parent process.
背景
PR #26(version packages)マージ後の Release ワークフローの publish ジョブが失敗しました:
NPM_TOKENシークレットは正しく渡っており(ログ上NPM_TOKEN: ***)、~/.npmrcも書き込み済みでしたが、bun publishは CI で~/.npmrcの認証トークンを読み取れない既知のバグがあります(oven-sh/bun#24124)。同じ.npmrcでnpm publishは成功します。修正
publish を 2ツール構成に変更:
bun pm packで tarball を生成 — bun がworkspace:*を実バージョンに解決(npm publishを直接使うとworkspace:*が残りEUNSUPPORTEDPROTOCOLになる問題を回避)npm publish <tarball> --access publicでアップロード — npm は~/.npmrcのトークンを確実に読む。tarball の manifest は解決済みなので npm がworkspace:に遭遇することはない冪等性・
workspace:混入ガード・New tag:マーカー出力は変更なし。検証
ローカルで確認済み:
@otomatty/core→"@otomatty/tokens": "0.0.0"、workspace:なし)npm publish <tarball> --access public --dry-runが tarball を受理(+ @otomatty/core@0.0.0、public access)マージ後
このPRをマージ → Release ワークフローの失敗した publish を再実行(または PR #26 を再マージ)すれば、
@otomatty/* v0.1.0が npm に公開されます。🤖 Generated with Claude Code
Generated by Claude Code