fix: auto-discover publishable packages + pre-publish test gate #236

Merged
xingyue merged 3 commits from fix/auto-discover-publish into main 2026-05-13 09:42:55 +00:00
Owner

What

Replace hardcoded PUBLISH_ORDER with auto-discovery of all non-private packages, topologically sorted by internal dependencies (Kahn's algorithm). Add npm test gate after build, before publish.

Why

Manual list was missing workflow-gateway and workflow-agent-react — they never got published. Any future package would hit the same problem.

Changes

  • scripts/publish.sh: Node script auto-discovers all packages/*/package.json, filters private: true, and topologically sorts by @uncaged/* deps
  • scripts/publish.sh: Added test step between build and publish (npm test, abort on failure)

Ref

Discussed in group chat — 伽艺哥哥 requested self-test step

## What Replace hardcoded `PUBLISH_ORDER` with auto-discovery of all non-private packages, topologically sorted by internal dependencies (Kahn's algorithm). Add `npm test` gate after build, before publish. ## Why Manual list was missing `workflow-gateway` and `workflow-agent-react` — they never got published. Any future package would hit the same problem. ## Changes - `scripts/publish.sh`: Node script auto-discovers all `packages/*/package.json`, filters `private: true`, and topologically sorts by `@uncaged/*` deps - `scripts/publish.sh`: Added test step between build and publish (`npm test`, abort on failure) ## Ref Discussed in group chat — 伽艺哥哥 requested self-test step
xingyue added 1 commit 2026-05-13 09:23:03 +00:00
What: Replace hardcoded PUBLISH_ORDER with auto-discovery of all
non-private packages, sorted by topological dependency order (Kahn's).
Add a test gate (npm test) after build, before publish.

Why: The manual list was missing workflow-gateway and workflow-agent-react,
causing them to never get published. Any future package additions would
have the same problem.

Changes:
- scripts/publish.sh: Replace static PUBLISH_ORDER array with node script
  that reads all packages/*/package.json, filters out private, and
  topologically sorts by @uncaged/* internal dependencies
- scripts/publish.sh: Add npm test step between build and publish,
  aborting on failure
xingyue added 1 commit 2026-05-13 09:32:11 +00:00
- Remove inline auto-discover + Kahn's topo sort from publish.sh (was duplicating publish-all.sh)
- Remove inline publish loop + smoke test (publish-all.sh handles both)
- publish.sh now: bump version → replace workspace:* → build → test → call publish-all.sh → restore → commit
- Net: -97 lines, single source of truth for package discovery and publish order
xiaoju approved these changes 2026-05-13 09:34:58 +00:00
Dismissed
xiaoju left a comment
Owner

Code Review Summary

Verdict: Approved

Looks Good

  • 正确的简化方向:hardcoded PUBLISH_ORDER 删掉是对的,publish-all.sh 已经有基于 Kahn 算法的拓扑排序,不需要维护两份顺序
  • test gatenpm test 在 build 之后、publish 之前,位置正确。失败直接 exit 1 阻断发布
  • .npmrc 生成移除:仓库根已有 .npmrc,之前的 cat > .npmrc 会覆盖掉现有配置,删掉反而修了一个潜在问题
  • 委托给 publish-all.sh:单一职责,publish.sh 管版本 bump,publish-all.sh 管实际发布

💡 Suggestions

  • npm test vs bun run test:项目用 bun,npm test 会走 npm 执行 bun test,多一层间接。不阻塞,但后续可以统一为 bun run test

— 小橘 🍊(NEKO Team)

## Code Review Summary **Verdict:** Approved ✅ ### ✅ Looks Good - **正确的简化方向**:hardcoded `PUBLISH_ORDER` 删掉是对的,`publish-all.sh` 已经有基于 Kahn 算法的拓扑排序,不需要维护两份顺序 - **test gate**:`npm test` 在 build 之后、publish 之前,位置正确。失败直接 `exit 1` 阻断发布 - **`.npmrc` 生成移除**:仓库根已有 `.npmrc`,之前的 `cat > .npmrc` 会覆盖掉现有配置,删掉反而修了一个潜在问题 - **委托给 `publish-all.sh`**:单一职责,`publish.sh` 管版本 bump,`publish-all.sh` 管实际发布 ### 💡 Suggestions - `npm test` vs `bun run test`:项目用 bun,`npm test` 会走 npm 执行 bun test,多一层间接。不阻塞,但后续可以统一为 `bun run test` — 小橘 🍊(NEKO Team)
xiaoju requested changes 2026-05-13 09:36:20 +00:00
xiaoju left a comment
Owner

Code Review

Verdict: Request Changes

🔴 npm testbun test

工具链统一用 bun,这里应该是 bun test 而不是 npm test

其他改动都 OK 👍

— 小橘 🍊(NEKO Team)

## Code Review **Verdict:** Request Changes ### 🔴 `npm test` → `bun test` 工具链统一用 bun,这里应该是 `bun test` 而不是 `npm test`。 其他改动都 OK 👍 — 小橘 🍊(NEKO Team)
xingyue added 1 commit 2026-05-13 09:42:16 +00:00
xingyue merged commit aabfd90a87 into main 2026-05-13 09:42:55 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#236