chore: publish v0.4.2 — fix workspace deps, remove publish.sh

- workspace:* → workspace:^ (resolves to ^x.y.z instead of exact)
- Remove publish.sh, use changesets workflow
- changeset config: access public (Gitea compat)
- release script: build + test + changeset publish
This commit is contained in:
2026-05-13 21:07:29 +08:00
parent ce5bc50210
commit 1cf963a1fb
35 changed files with 210 additions and 231 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
] ]
], ],
"linked": [], "linked": [],
"access": "restricted", "access": "public",
"baseBranch": "main", "baseBranch": "main",
"updateInternalDependencies": "patch", "updateInternalDependencies": "patch",
"ignore": [ "ignore": [
+1 -6
View File
@@ -10,14 +10,9 @@
"typecheck": "bunx tsc --build", "typecheck": "bunx tsc --build",
"format": "biome format --write .", "format": "biome format --write .",
"test": "bun run --filter '*' test", "test": "bun run --filter '*' test",
"link": "./scripts/link-all.sh",
"link:consume": "./scripts/link-all.sh --consume",
"link:unlink": "./scripts/link-all.sh --unlink",
"publish:gitea": "./scripts/publish.sh patch",
"publish:gitea:dry": "./scripts/publish.sh --dry-run patch",
"changeset": "bunx changeset", "changeset": "bunx changeset",
"version": "bunx changeset version", "version": "bunx changeset version",
"release": "bunx changeset publish --no-git-tag" "release": "bun run build && bun test && bunx changeset publish --no-git-tag"
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "^2.4.14", "@biomejs/biome": "^2.4.14",
+14
View File
@@ -1,5 +1,19 @@
# @uncaged/cli-workflow # @uncaged/cli-workflow
## 0.4.2
### Patch Changes
- Fix workspace dependency resolution: use workspace:^ so published packages resolve to compatible versions instead of exact (non-existent) versions.
- Updated dependencies
- @uncaged/workflow-cas@0.4.2
- @uncaged/workflow-execute@0.4.2
- @uncaged/workflow-gateway@0.4.2
- @uncaged/workflow-protocol@0.4.2
- @uncaged/workflow-register@0.4.2
- @uncaged/workflow-runtime@0.4.2
- @uncaged/workflow-util@0.4.2
## 0.4.0 ## 0.4.0
### Minor Changes ### Minor Changes
+8 -8
View File
@@ -1,6 +1,6 @@
{ {
"name": "@uncaged/cli-workflow", "name": "@uncaged/cli-workflow",
"version": "0.4.1", "version": "0.4.2",
"files": [ "files": [
"src", "src",
"dist", "dist",
@@ -11,13 +11,13 @@
"uncaged-workflow": "src/cli.ts" "uncaged-workflow": "src/cli.ts"
}, },
"dependencies": { "dependencies": {
"@uncaged/workflow-gateway": "workspace:*", "@uncaged/workflow-gateway": "workspace:^",
"@uncaged/workflow-protocol": "workspace:*", "@uncaged/workflow-protocol": "workspace:^",
"@uncaged/workflow-util": "workspace:*", "@uncaged/workflow-util": "workspace:^",
"@uncaged/workflow-cas": "workspace:*", "@uncaged/workflow-cas": "workspace:^",
"@uncaged/workflow-execute": "workspace:*", "@uncaged/workflow-execute": "workspace:^",
"@uncaged/workflow-register": "workspace:*", "@uncaged/workflow-register": "workspace:^",
"@uncaged/workflow-runtime": "workspace:*", "@uncaged/workflow-runtime": "workspace:^",
"hono": "^4.12.18", "hono": "^4.12.18",
"yaml": "^2.8.4" "yaml": "^2.8.4"
}, },
@@ -1,5 +1,17 @@
# @uncaged/workflow-agent-cursor # @uncaged/workflow-agent-cursor
## 0.4.2
### Patch Changes
- Fix workspace dependency resolution: use workspace:^ so published packages resolve to compatible versions instead of exact (non-existent) versions.
- Updated dependencies
- @uncaged/workflow-protocol@0.4.2
- @uncaged/workflow-reactor@0.4.2
- @uncaged/workflow-runtime@0.4.2
- @uncaged/workflow-util-agent@0.4.2
- @uncaged/workflow-util@0.4.2
## 0.4.0 ## 0.4.0
### Minor Changes ### Minor Changes
+6 -6
View File
@@ -1,6 +1,6 @@
{ {
"name": "@uncaged/workflow-agent-cursor", "name": "@uncaged/workflow-agent-cursor",
"version": "0.4.1", "version": "0.4.2",
"files": [ "files": [
"dist", "dist",
"package.json" "package.json"
@@ -11,11 +11,11 @@
"test": "bun test" "test": "bun test"
}, },
"dependencies": { "dependencies": {
"@uncaged/workflow-protocol": "workspace:*", "@uncaged/workflow-protocol": "workspace:^",
"@uncaged/workflow-reactor": "workspace:*", "@uncaged/workflow-reactor": "workspace:^",
"@uncaged/workflow-runtime": "workspace:*", "@uncaged/workflow-runtime": "workspace:^",
"@uncaged/workflow-util": "workspace:*", "@uncaged/workflow-util": "workspace:^",
"@uncaged/workflow-util-agent": "workspace:*", "@uncaged/workflow-util-agent": "workspace:^",
"zod": "^4.0.0" "zod": "^4.0.0"
}, },
"exports": { "exports": {
@@ -1,5 +1,14 @@
# @uncaged/workflow-agent-hermes # @uncaged/workflow-agent-hermes
## 0.4.2
### Patch Changes
- Fix workspace dependency resolution: use workspace:^ so published packages resolve to compatible versions instead of exact (non-existent) versions.
- Updated dependencies
- @uncaged/workflow-runtime@0.4.2
- @uncaged/workflow-util-agent@0.4.2
## 0.4.0 ## 0.4.0
### Minor Changes ### Minor Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@uncaged/workflow-agent-hermes", "name": "@uncaged/workflow-agent-hermes",
"version": "0.4.1", "version": "0.4.2",
"files": [ "files": [
"dist", "dist",
"package.json" "package.json"
@@ -11,8 +11,8 @@
"test": "bun test" "test": "bun test"
}, },
"dependencies": { "dependencies": {
"@uncaged/workflow-runtime": "workspace:*", "@uncaged/workflow-runtime": "workspace:^",
"@uncaged/workflow-util-agent": "workspace:*" "@uncaged/workflow-util-agent": "workspace:^"
}, },
"exports": { "exports": {
".": { ".": {
+9
View File
@@ -1,5 +1,14 @@
# @uncaged/workflow-agent-llm # @uncaged/workflow-agent-llm
## 0.4.2
### Patch Changes
- Fix workspace dependency resolution: use workspace:^ so published packages resolve to compatible versions instead of exact (non-existent) versions.
- Updated dependencies
- @uncaged/workflow-runtime@0.4.2
- @uncaged/workflow-util-agent@0.4.2
## 0.4.0 ## 0.4.0
### Minor Changes ### Minor Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@uncaged/workflow-agent-llm", "name": "@uncaged/workflow-agent-llm",
"version": "0.4.1", "version": "0.4.2",
"files": [ "files": [
"dist", "dist",
"package.json" "package.json"
@@ -11,8 +11,8 @@
"test": "bun test" "test": "bun test"
}, },
"dependencies": { "dependencies": {
"@uncaged/workflow-runtime": "workspace:*", "@uncaged/workflow-runtime": "workspace:^",
"@uncaged/workflow-util-agent": "workspace:*" "@uncaged/workflow-util-agent": "workspace:^"
}, },
"devDependencies": { "devDependencies": {
"zod": "^4.0.0" "zod": "^4.0.0"
@@ -1,5 +1,15 @@
# @uncaged/workflow-agent-react # @uncaged/workflow-agent-react
## 0.4.2
### Patch Changes
- Fix workspace dependency resolution: use workspace:^ so published packages resolve to compatible versions instead of exact (non-existent) versions.
- Updated dependencies
- @uncaged/workflow-protocol@0.4.2
- @uncaged/workflow-reactor@0.4.2
- @uncaged/workflow-util-agent@0.4.2
## 0.4.0 ## 0.4.0
### Minor Changes ### Minor Changes
+4 -4
View File
@@ -1,6 +1,6 @@
{ {
"name": "@uncaged/workflow-agent-react", "name": "@uncaged/workflow-agent-react",
"version": "0.4.1", "version": "0.4.2",
"files": [ "files": [
"dist", "dist",
"package.json" "package.json"
@@ -18,9 +18,9 @@
"test": "bun test" "test": "bun test"
}, },
"dependencies": { "dependencies": {
"@uncaged/workflow-protocol": "workspace:*", "@uncaged/workflow-protocol": "workspace:^",
"@uncaged/workflow-reactor": "workspace:*", "@uncaged/workflow-reactor": "workspace:^",
"@uncaged/workflow-util-agent": "workspace:*" "@uncaged/workflow-util-agent": "workspace:^"
}, },
"devDependencies": { "devDependencies": {
"zod": "^4.0.0" "zod": "^4.0.0"
+9
View File
@@ -1,5 +1,14 @@
# @uncaged/workflow-cas # @uncaged/workflow-cas
## 0.4.2
### Patch Changes
- Fix workspace dependency resolution: use workspace:^ so published packages resolve to compatible versions instead of exact (non-existent) versions.
- Updated dependencies
- @uncaged/workflow-protocol@0.4.2
- @uncaged/workflow-util@0.4.2
## 0.4.0 ## 0.4.0
### Minor Changes ### Minor Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@uncaged/workflow-cas", "name": "@uncaged/workflow-cas",
"version": "0.4.1", "version": "0.4.2",
"files": [ "files": [
"dist", "dist",
"package.json" "package.json"
@@ -17,8 +17,8 @@
} }
}, },
"dependencies": { "dependencies": {
"@uncaged/workflow-protocol": "workspace:*", "@uncaged/workflow-protocol": "workspace:^",
"@uncaged/workflow-util": "workspace:*", "@uncaged/workflow-util": "workspace:^",
"xxhashjs": "^0.2.2", "xxhashjs": "^0.2.2",
"yaml": "^2.7.1" "yaml": "^2.7.1"
}, },
+13
View File
@@ -1,5 +1,18 @@
# @uncaged/workflow-execute # @uncaged/workflow-execute
## 0.4.2
### Patch Changes
- Fix workspace dependency resolution: use workspace:^ so published packages resolve to compatible versions instead of exact (non-existent) versions.
- Updated dependencies
- @uncaged/workflow-cas@0.4.2
- @uncaged/workflow-protocol@0.4.2
- @uncaged/workflow-reactor@0.4.2
- @uncaged/workflow-register@0.4.2
- @uncaged/workflow-runtime@0.4.2
- @uncaged/workflow-util@0.4.2
## 0.4.0 ## 0.4.0
### Minor Changes ### Minor Changes
+7 -7
View File
@@ -1,6 +1,6 @@
{ {
"name": "@uncaged/workflow-execute", "name": "@uncaged/workflow-execute",
"version": "0.4.1", "version": "0.4.2",
"files": [ "files": [
"dist", "dist",
"package.json" "package.json"
@@ -17,12 +17,12 @@
"test": "bun test" "test": "bun test"
}, },
"dependencies": { "dependencies": {
"@uncaged/workflow-protocol": "workspace:*", "@uncaged/workflow-protocol": "workspace:^",
"@uncaged/workflow-runtime": "workspace:*", "@uncaged/workflow-runtime": "workspace:^",
"@uncaged/workflow-util": "workspace:*", "@uncaged/workflow-util": "workspace:^",
"@uncaged/workflow-cas": "workspace:*", "@uncaged/workflow-cas": "workspace:^",
"@uncaged/workflow-reactor": "workspace:*", "@uncaged/workflow-reactor": "workspace:^",
"@uncaged/workflow-register": "workspace:*", "@uncaged/workflow-register": "workspace:^",
"yaml": "^2.7.1" "yaml": "^2.7.1"
}, },
"peerDependencies": { "peerDependencies": {
+6
View File
@@ -1,5 +1,11 @@
# @uncaged/workflow-gateway # @uncaged/workflow-gateway
## 0.4.2
### Patch Changes
- Fix workspace dependency resolution: use workspace:^ so published packages resolve to compatible versions instead of exact (non-existent) versions.
## 0.4.0 ## 0.4.0
### Minor Changes ### Minor Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@uncaged/workflow-gateway", "name": "@uncaged/workflow-gateway",
"version": "0.4.1", "version": "0.4.2",
"files": [ "files": [
"dist", "dist",
"package.json" "package.json"
+6
View File
@@ -1,5 +1,11 @@
# @uncaged/workflow-protocol # @uncaged/workflow-protocol
## 0.4.2
### Patch Changes
- Fix workspace dependency resolution: use workspace:^ so published packages resolve to compatible versions instead of exact (non-existent) versions.
## 0.4.0 ## 0.4.0
### Minor Changes ### Minor Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@uncaged/workflow-protocol", "name": "@uncaged/workflow-protocol",
"version": "0.4.1", "version": "0.4.2",
"files": [ "files": [
"dist", "dist",
"package.json" "package.json"
+8
View File
@@ -1,5 +1,13 @@
# @uncaged/workflow-reactor # @uncaged/workflow-reactor
## 0.4.2
### Patch Changes
- Fix workspace dependency resolution: use workspace:^ so published packages resolve to compatible versions instead of exact (non-existent) versions.
- Updated dependencies
- @uncaged/workflow-protocol@0.4.2
## 0.4.0 ## 0.4.0
### Minor Changes ### Minor Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@uncaged/workflow-reactor", "name": "@uncaged/workflow-reactor",
"version": "0.4.1", "version": "0.4.2",
"files": [ "files": [
"dist", "dist",
"package.json" "package.json"
@@ -14,7 +14,7 @@
} }
}, },
"dependencies": { "dependencies": {
"@uncaged/workflow-protocol": "workspace:*" "@uncaged/workflow-protocol": "workspace:^"
}, },
"peerDependencies": { "peerDependencies": {
"zod": "^4.0.0" "zod": "^4.0.0"
+9
View File
@@ -1,5 +1,14 @@
# @uncaged/workflow-register # @uncaged/workflow-register
## 0.4.2
### Patch Changes
- Fix workspace dependency resolution: use workspace:^ so published packages resolve to compatible versions instead of exact (non-existent) versions.
- Updated dependencies
- @uncaged/workflow-protocol@0.4.2
- @uncaged/workflow-util@0.4.2
## 0.4.0 ## 0.4.0
### Minor Changes ### Minor Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@uncaged/workflow-register", "name": "@uncaged/workflow-register",
"version": "0.4.1", "version": "0.4.2",
"files": [ "files": [
"dist", "dist",
"package.json" "package.json"
@@ -14,8 +14,8 @@
} }
}, },
"dependencies": { "dependencies": {
"@uncaged/workflow-protocol": "workspace:*", "@uncaged/workflow-protocol": "workspace:^",
"@uncaged/workflow-util": "workspace:*" "@uncaged/workflow-util": "workspace:^"
}, },
"peerDependencies": { "peerDependencies": {
"acorn": "^8.0.0", "acorn": "^8.0.0",
+9
View File
@@ -1,5 +1,14 @@
# @uncaged/workflow-runtime # @uncaged/workflow-runtime
## 0.4.2
### Patch Changes
- Fix workspace dependency resolution: use workspace:^ so published packages resolve to compatible versions instead of exact (non-existent) versions.
- Updated dependencies
- @uncaged/workflow-cas@0.4.2
- @uncaged/workflow-protocol@0.4.2
## 0.4.0 ## 0.4.0
### Minor Changes ### Minor Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@uncaged/workflow-runtime", "name": "@uncaged/workflow-runtime",
"version": "0.4.1", "version": "0.4.2",
"files": [ "files": [
"dist", "dist",
"package.json" "package.json"
@@ -11,8 +11,8 @@
"test": "bun test" "test": "bun test"
}, },
"dependencies": { "dependencies": {
"@uncaged/workflow-cas": "workspace:*", "@uncaged/workflow-cas": "workspace:^",
"@uncaged/workflow-protocol": "workspace:*" "@uncaged/workflow-protocol": "workspace:^"
}, },
"peerDependencies": { "peerDependencies": {
"zod": "^4.0.0" "zod": "^4.0.0"
@@ -1,5 +1,14 @@
# @uncaged/workflow-template-develop # @uncaged/workflow-template-develop
## 0.4.2
### Patch Changes
- Fix workspace dependency resolution: use workspace:^ so published packages resolve to compatible versions instead of exact (non-existent) versions.
- Updated dependencies
- @uncaged/workflow-register@0.4.2
- @uncaged/workflow-runtime@0.4.2
## 0.4.0 ## 0.4.0
### Minor Changes ### Minor Changes
@@ -1,6 +1,6 @@
{ {
"name": "@uncaged/workflow-template-develop", "name": "@uncaged/workflow-template-develop",
"version": "0.4.1", "version": "0.4.2",
"files": [ "files": [
"dist", "dist",
"package.json" "package.json"
@@ -17,11 +17,11 @@
"test": "bun test" "test": "bun test"
}, },
"dependencies": { "dependencies": {
"@uncaged/workflow-register": "workspace:*", "@uncaged/workflow-register": "workspace:^",
"@uncaged/workflow-runtime": "workspace:*", "@uncaged/workflow-runtime": "workspace:^",
"zod": "^4.0.0" "zod": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {
"@uncaged/workflow-protocol": "workspace:*" "@uncaged/workflow-protocol": "workspace:^"
} }
} }
@@ -1,5 +1,14 @@
# @uncaged/workflow-template-solve-issue # @uncaged/workflow-template-solve-issue
## 0.4.2
### Patch Changes
- Fix workspace dependency resolution: use workspace:^ so published packages resolve to compatible versions instead of exact (non-existent) versions.
- Updated dependencies
- @uncaged/workflow-register@0.4.2
- @uncaged/workflow-runtime@0.4.2
## 0.4.0 ## 0.4.0
### Minor Changes ### Minor Changes
@@ -1,6 +1,6 @@
{ {
"name": "@uncaged/workflow-template-solve-issue", "name": "@uncaged/workflow-template-solve-issue",
"version": "0.4.1", "version": "0.4.2",
"files": [ "files": [
"dist", "dist",
"package.json" "package.json"
@@ -17,13 +17,13 @@
"test": "bun test" "test": "bun test"
}, },
"dependencies": { "dependencies": {
"@uncaged/workflow-register": "workspace:*", "@uncaged/workflow-register": "workspace:^",
"@uncaged/workflow-runtime": "workspace:*", "@uncaged/workflow-runtime": "workspace:^",
"zod": "^4.0.0" "zod": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {
"@uncaged/workflow-cas": "workspace:*", "@uncaged/workflow-cas": "workspace:^",
"@uncaged/workflow-execute": "workspace:*", "@uncaged/workflow-execute": "workspace:^",
"@uncaged/workflow-protocol": "workspace:*" "@uncaged/workflow-protocol": "workspace:^"
} }
} }
@@ -1,5 +1,14 @@
# @uncaged/workflow-util-agent # @uncaged/workflow-util-agent
## 0.4.2
### Patch Changes
- Fix workspace dependency resolution: use workspace:^ so published packages resolve to compatible versions instead of exact (non-existent) versions.
- Updated dependencies
- @uncaged/workflow-cas@0.4.2
- @uncaged/workflow-runtime@0.4.2
## 0.4.0 ## 0.4.0
### Minor Changes ### Minor Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@uncaged/workflow-util-agent", "name": "@uncaged/workflow-util-agent",
"version": "0.4.1", "version": "0.4.2",
"files": [ "files": [
"dist", "dist",
"package.json" "package.json"
@@ -18,8 +18,8 @@
"test": "bun test" "test": "bun test"
}, },
"dependencies": { "dependencies": {
"@uncaged/workflow-runtime": "workspace:*", "@uncaged/workflow-runtime": "workspace:^",
"@uncaged/workflow-cas": "workspace:*", "@uncaged/workflow-cas": "workspace:^",
"zod": "^4.0.0" "zod": "^4.0.0"
} }
} }
+8
View File
@@ -1,5 +1,13 @@
# @uncaged/workflow-util # @uncaged/workflow-util
## 0.4.2
### Patch Changes
- Fix workspace dependency resolution: use workspace:^ so published packages resolve to compatible versions instead of exact (non-existent) versions.
- Updated dependencies
- @uncaged/workflow-protocol@0.4.2
## 0.4.0 ## 0.4.0
### Minor Changes ### Minor Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@uncaged/workflow-util", "name": "@uncaged/workflow-util",
"version": "0.4.1", "version": "0.4.2",
"files": [ "files": [
"dist", "dist",
"package.json" "package.json"
@@ -14,7 +14,7 @@
} }
}, },
"dependencies": { "dependencies": {
"@uncaged/workflow-protocol": "workspace:*" "@uncaged/workflow-protocol": "workspace:^"
}, },
"devDependencies": { "devDependencies": {
"typescript": "^5.8.3" "typescript": "^5.8.3"
-165
View File
@@ -1,165 +0,0 @@
#!/usr/bin/env bash
# publish.sh — Bump version, build, test, topologically publish @uncaged/* to Gitea npm
#
# Usage:
# ./scripts/publish.sh 0.4.0 # explicit version
# ./scripts/publish.sh patch # 0.3.1 → 0.3.2
# ./scripts/publish.sh minor # 0.3.1 → 0.4.0
# ./scripts/publish.sh major # 0.3.1 → 1.0.0
# ./scripts/publish.sh --dry-run patch # dry-run bun publish only (no git commit/push)
#
# Env (via `cfg` or export):
# GITEA_TOKEN — Gitea npm registry auth (see root .npmrc)
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$REPO_ROOT"
GITEA_TOKEN="${GITEA_TOKEN:?GITEA_TOKEN is required}"
REGISTRY="https://git.shazhou.work/api/packages/uncaged/npm/"
DRY_RUN=""
if [[ "${1:-}" == "--dry-run" ]]; then
DRY_RUN="--dry-run"
shift
echo "🔍 Dry run — bun publish will not upload; git commit/push skipped"
echo
fi
# ─── Version ─────────────────────────────────────────────────────────────────
current_version() {
node -e "console.log(require('./packages/workflow-protocol/package.json').version)"
}
bump_version() {
local cur="$1" kind="$2"
IFS='.' read -r major minor patch <<< "$cur"
case "$kind" in
patch) echo "${major}.${minor}.$((patch + 1))" ;;
minor) echo "${major}.$((minor + 1)).0" ;;
major) echo "$((major + 1)).0.0" ;;
*) echo "$kind" ;;
esac
}
CURRENT=$(current_version)
VERSION=$(bump_version "$CURRENT" "${1:?Usage: publish.sh [--dry-run] <version|patch|minor|major>}")
echo "📦 Publish: $CURRENT$VERSION"
# ─── Bump version ─────────────────────────────────────────────────────────────
echo "🔢 Bumping versions..."
for dir in packages/*/; do
pkg="$dir/package.json"
[[ -f "$pkg" ]] || continue
is_private=$(node -e "console.log(require('./$pkg').private || false)")
[[ "$is_private" == "true" ]] && continue
node -e "
const fs = require('fs');
const p = JSON.parse(fs.readFileSync('$pkg','utf8'));
p.version = '$VERSION';
fs.writeFileSync('$pkg', JSON.stringify(p, null, 2) + '\n');
"
done
# ─── Topological publish order (workspace:* deps first) ───────────────────────
ORDERED=$(python3 -c "
import json, sys
from pathlib import Path
pkgs_dir = Path('$REPO_ROOT/packages')
name_to_dir = {}
for d in sorted(pkgs_dir.iterdir()):
pj = d / 'package.json'
if not pj.exists():
continue
data = json.loads(pj.read_text())
name = data.get('name', '')
if not name.startswith('@uncaged/') or data.get('private'):
continue
name_to_dir[name] = d.name
deps_graph = {}
for name, dirname in name_to_dir.items():
pj = pkgs_dir / dirname / 'package.json'
data = json.loads(pj.read_text())
local_deps = set()
for section in ('dependencies', 'devDependencies', 'peerDependencies'):
for dep, ver in data.get(section, {}).items():
if dep.startswith('@uncaged/') and dep in name_to_dir and ver.startswith('workspace:'):
local_deps.add(dep)
deps_graph[name] = local_deps
in_degree = {n: 0 for n in deps_graph}
for n, ds in deps_graph.items():
in_degree[n] = len(ds)
queue = sorted([n for n, deg in in_degree.items() if deg == 0])
result = []
while queue:
node = queue.pop(0)
result.append(node)
for n, ds in deps_graph.items():
if node in ds:
in_degree[n] -= 1
if in_degree[n] == 0:
queue.append(n)
queue.sort()
if len(result) != len(deps_graph):
missing = set(deps_graph) - set(result)
sys.stderr.write('publish: cyclic @uncaged/ workspace:* dependencies among: ' + ', '.join(sorted(missing)) + '\n')
sys.exit(1)
for name in result:
print(name_to_dir[name])
")
# ─── Build ────────────────────────────────────────────────────────────────────
echo "🔨 Building..."
bun run build
# ─── Self-test ────────────────────────────────────────────────────────────────
echo "🧪 Running tests..."
if ! bun test; then
echo "❌ Tests failed — aborting publish"
exit 1
fi
# ─── Publish (bun resolves workspace:* for publish) ──────────────────────────
echo "🚀 Publishing to $REGISTRY ..."
ok=0
fail=0
while IFS= read -r pkg; do
[[ -n "$pkg" ]] || continue
dir="$REPO_ROOT/packages/$pkg"
name=$(node -e "console.log(require('$dir/package.json').name)")
if ( cd "$dir" && bun publish --registry="$REGISTRY" ${DRY_RUN:+"$DRY_RUN"} ); then
echo "$name"
ok=$((ok + 1))
else
echo "⚠️ $name (publish failed or version may already exist)"
fail=$((fail + 1))
fi
done <<< "$ORDERED"
echo
echo "Published: $ok Skipped/Failed: $fail"
# ─── Commit ───────────────────────────────────────────────────────────────────
if [[ -n "$DRY_RUN" ]]; then
echo "⏭️ Skipping git commit/push (dry run). Revert bumps with: git checkout -- packages/*/package.json"
exit 0
fi
echo "📝 Committing..."
git add -A
git commit -m "chore: publish v${VERSION}
小橘 <xiaoju@shazhou.work>"
git push
echo "✅ v${VERSION} published"