feat(publish): add Gitea npm registry publish script + docs
- scripts/publish-all.sh: bun pm pack (resolves workspace:*) + npm publish - All 14 public @uncaged/* packages published to git.shazhou.work - CLAUDE.md: document Gitea registry, bunfig.toml scoped registry, publish workflow - bun link docs demoted to alternative for un-published local changes
This commit is contained in:
@@ -245,22 +245,40 @@ bun run format # biome format --write
|
||||
bun test # run tests
|
||||
```
|
||||
|
||||
### Cross-repo Development (bun link)
|
||||
### Publishing to Gitea npm Registry
|
||||
|
||||
For developing workflows in a separate repo (e.g. `xingyue-workflows`) against local monorepo packages:
|
||||
All public `@uncaged/*` packages are published to the Gitea npm registry at `git.shazhou.work`. Workflow workspaces consume packages from this registry via `bunfig.toml`.
|
||||
|
||||
```bash
|
||||
# 1. Register all @uncaged/* packages (run once from monorepo root)
|
||||
bun run link
|
||||
# Publish all packages (bun pm pack resolves workspace:* → actual versions)
|
||||
bun run publish:gitea
|
||||
|
||||
# 2. Consume linked packages (run from the external workflow repo)
|
||||
bun run link:consume
|
||||
|
||||
# 3. Restore original npm versions (undo link)
|
||||
bun run link:unlink
|
||||
# Dry run — see what would be published
|
||||
bun run publish:gitea:dry
|
||||
```
|
||||
|
||||
The script is at `scripts/link-all.sh`. It links/unlinks all 16 `@uncaged/*` packages.
|
||||
Prerequisites: `.npmrc` in monorepo root with Gitea auth token (`//git.shazhou.work/api/packages/shazhou/npm/:_authToken=<token>`).
|
||||
|
||||
### Workflow Workspace Setup
|
||||
|
||||
External workflow repos (e.g. `xingyue-workflows`) use the Gitea registry for `@uncaged/*` packages. Add a `bunfig.toml`:
|
||||
|
||||
```toml
|
||||
[install.scopes]
|
||||
"@uncaged" = "https://git.shazhou.work/api/packages/shazhou/npm/"
|
||||
```
|
||||
|
||||
Then `bun install` resolves `@uncaged/*` from Gitea, all other packages from npmjs.
|
||||
|
||||
### Cross-repo Development (bun link)
|
||||
|
||||
Alternative for development against un-published local changes:
|
||||
|
||||
```bash
|
||||
bun run link # Register all packages (from monorepo root)
|
||||
bun run link:consume # Link into CWD's project (⚠️ don't bun install after)
|
||||
bun run link:unlink # Restore original deps
|
||||
```
|
||||
|
||||
## Commit Convention
|
||||
|
||||
|
||||
+3
-1
@@ -12,7 +12,9 @@
|
||||
"test": "bun run --filter '*' test",
|
||||
"link": "./scripts/link-all.sh",
|
||||
"link:consume": "./scripts/link-all.sh --consume",
|
||||
"link:unlink": "./scripts/link-all.sh --unlink"
|
||||
"link:unlink": "./scripts/link-all.sh --unlink",
|
||||
"publish:gitea": "./scripts/publish-all.sh",
|
||||
"publish:gitea:dry": "./scripts/publish-all.sh --dry-run"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^2.4.14",
|
||||
|
||||
Executable
+81
@@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env bash
|
||||
# Publish all public @uncaged/* packages to Gitea npm registry.
|
||||
#
|
||||
# Usage:
|
||||
# ./scripts/publish-all.sh # Publish all packages
|
||||
# ./scripts/publish-all.sh --dry-run # Show what would be published
|
||||
#
|
||||
# Prerequisites:
|
||||
# - .npmrc in monorepo root with Gitea auth token
|
||||
# - bun (for packing with workspace:* resolution)
|
||||
# - npm (for publishing tarballs)
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
MONOREPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
|
||||
REGISTRY="https://git.shazhou.work/api/packages/shazhou/npm/"
|
||||
DRY_RUN=""
|
||||
|
||||
if [[ "${1:-}" == "--dry-run" ]]; then
|
||||
DRY_RUN="--dry-run"
|
||||
echo "🔍 Dry run mode — no packages will be published"
|
||||
echo
|
||||
fi
|
||||
|
||||
# Dependency order matters: leaf packages first
|
||||
PACKAGES=(
|
||||
workflow-protocol
|
||||
workflow-util
|
||||
workflow-cas
|
||||
workflow-runtime
|
||||
workflow-reactor
|
||||
workflow-register
|
||||
workflow-execute
|
||||
workflow-util-agent
|
||||
workflow-agent-cursor
|
||||
workflow-agent-hermes
|
||||
workflow-agent-llm
|
||||
workflow-template-develop
|
||||
workflow-template-solve-issue
|
||||
cli-workflow
|
||||
)
|
||||
|
||||
ok=0
|
||||
fail=0
|
||||
|
||||
for pkg in "${PACKAGES[@]}"; do
|
||||
dir="$MONOREPO_ROOT/packages/$pkg"
|
||||
[[ -f "$dir/package.json" ]] || { echo "⚠️ skip $pkg (no package.json)"; continue; }
|
||||
|
||||
# Skip private packages
|
||||
if grep -q '"private": true' "$dir/package.json" 2>/dev/null; then
|
||||
echo " skip @uncaged/$pkg (private)"
|
||||
continue
|
||||
fi
|
||||
|
||||
cd "$dir"
|
||||
|
||||
# bun pm pack resolves workspace:* → actual versions
|
||||
tgz=$(bun pm pack 2>&1 | grep '\.tgz' | grep -v packed | head -1 | tr -d ' ')
|
||||
|
||||
if [[ -z "$tgz" || ! -f "$tgz" ]]; then
|
||||
echo "❌ @uncaged/$pkg — pack failed"
|
||||
((fail++)) || true
|
||||
continue
|
||||
fi
|
||||
|
||||
if npm publish "$tgz" --registry="$REGISTRY" $DRY_RUN 2>&1 | tail -1 | grep -q '+'; then
|
||||
echo "✅ @uncaged/$pkg"
|
||||
((ok++)) || true
|
||||
else
|
||||
# Could be "already published" — not necessarily an error
|
||||
echo "⚠️ @uncaged/$pkg (may already exist at this version)"
|
||||
fi
|
||||
|
||||
rm -f "$tgz"
|
||||
done
|
||||
|
||||
echo
|
||||
echo "Published: $ok Skipped/Failed: $fail"
|
||||
Reference in New Issue
Block a user