Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a1bc01ed85 | |||
| d3b5d66208 | |||
| eff5fb332a | |||
| 658a4a24ef | |||
| aabfd90a87 |
@@ -229,6 +229,37 @@ const mod = await import(bundlePath);
|
||||
|
||||
Test files (`__tests__/**`) are exempt.
|
||||
|
||||
## Package Build & Distribution
|
||||
|
||||
每个包用 `tsc` 编译出 `.js` + `.d.ts` 到 `dist/`,**发布 `dist`,不发 `src`,不 bundle**。
|
||||
|
||||
### 规则
|
||||
|
||||
- ✅ `tsc --build` 编译,保留目录结构(tree-shaking 友好)
|
||||
- ✅ `package.json` 的 `exports` 指向 `dist/`(编译产物),不指向 `src/`
|
||||
- ✅ 消费端不受 tsconfig 差异影响
|
||||
- ❌ 不要用 rollup/esbuild 打成单文件
|
||||
- ❌ `exports` 中不要出现 `./src/`
|
||||
|
||||
### package.json exports 格式
|
||||
|
||||
```json
|
||||
{
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
多入口同理,所有路径指向 `dist/`。
|
||||
|
||||
### 例外
|
||||
|
||||
- `workflow-gateway`(Cloudflare Workers)和 `workflow-dashboard`(私有 app)不发 npm,exports 可指向 `src/`。
|
||||
|
||||
## Toolchain
|
||||
|
||||
| Tool | Purpose |
|
||||
|
||||
+2
-2
@@ -13,8 +13,8 @@
|
||||
"link": "./scripts/link-all.sh",
|
||||
"link:consume": "./scripts/link-all.sh --consume",
|
||||
"link:unlink": "./scripts/link-all.sh --unlink",
|
||||
"publish:gitea": "./scripts/publish-all.sh",
|
||||
"publish:gitea:dry": "./scripts/publish-all.sh --dry-run"
|
||||
"publish:gitea": "./scripts/publish.sh patch",
|
||||
"publish:gitea:dry": "./scripts/publish.sh --dry-run patch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^2.4.14",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@uncaged/cli-workflow",
|
||||
"version": "0.3.21",
|
||||
"version": "0.3.24",
|
||||
"files": [
|
||||
"src",
|
||||
"dist",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@uncaged/workflow-agent-cursor",
|
||||
"version": "0.3.21",
|
||||
"version": "0.3.24",
|
||||
"files": [
|
||||
"dist",
|
||||
"package.json"
|
||||
@@ -22,7 +22,7 @@
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./src/index.ts"
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@uncaged/workflow-agent-hermes",
|
||||
"version": "0.3.21",
|
||||
"version": "0.3.24",
|
||||
"files": [
|
||||
"dist",
|
||||
"package.json"
|
||||
@@ -18,7 +18,7 @@
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./src/index.ts"
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@uncaged/workflow-agent-llm",
|
||||
"version": "0.3.21",
|
||||
"version": "0.3.24",
|
||||
"files": [
|
||||
"dist",
|
||||
"package.json"
|
||||
@@ -21,7 +21,7 @@
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./src/index.ts"
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
{
|
||||
"name": "@uncaged/workflow-agent-react",
|
||||
"version": "0.3.21",
|
||||
"version": "0.3.24",
|
||||
"files": [
|
||||
"dist",
|
||||
"package.json"
|
||||
],
|
||||
"type": "module",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./src/index.ts",
|
||||
"default": "./src/index.ts"
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@uncaged/workflow-cas",
|
||||
"version": "0.3.21",
|
||||
"version": "0.3.24",
|
||||
"files": [
|
||||
"dist",
|
||||
"package.json"
|
||||
@@ -12,7 +12,7 @@
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./src/index.ts"
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@uncaged/workflow-execute",
|
||||
"version": "0.3.21",
|
||||
"version": "0.3.24",
|
||||
"files": [
|
||||
"dist",
|
||||
"package.json"
|
||||
@@ -9,7 +9,7 @@
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./src/index.ts"
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
/** Absolute path to `worker-host.ts` for spawning bundle worker processes. */
|
||||
/**
|
||||
* Absolute path to the worker script for spawning bundle worker processes.
|
||||
*
|
||||
* Uses `.js` extension so it resolves correctly whether running from
|
||||
* src/ (bun handles .js → .ts) or dist/ (compiled .js exists).
|
||||
*/
|
||||
export function getWorkerHostScriptPath(): string {
|
||||
return fileURLToPath(new URL("./worker.ts", import.meta.url));
|
||||
return fileURLToPath(new URL("./worker.js", import.meta.url));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@uncaged/workflow-gateway",
|
||||
"version": "0.3.21",
|
||||
"version": "0.3.24",
|
||||
"files": [
|
||||
"dist",
|
||||
"package.json"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@uncaged/workflow-protocol",
|
||||
"version": "0.3.21",
|
||||
"version": "0.3.24",
|
||||
"files": [
|
||||
"dist",
|
||||
"package.json"
|
||||
@@ -9,11 +9,11 @@
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./src/index.ts"
|
||||
"import": "./dist/index.js"
|
||||
},
|
||||
"./moderator-table.js": {
|
||||
"types": "./dist/moderator-table.d.ts",
|
||||
"import": "./src/moderator-table.ts"
|
||||
"import": "./dist/moderator-table.js"
|
||||
}
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@uncaged/workflow-reactor",
|
||||
"version": "0.3.21",
|
||||
"version": "0.3.24",
|
||||
"files": [
|
||||
"dist",
|
||||
"package.json"
|
||||
@@ -9,7 +9,7 @@
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./src/index.ts"
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@uncaged/workflow-register",
|
||||
"version": "0.3.21",
|
||||
"version": "0.3.24",
|
||||
"files": [
|
||||
"dist",
|
||||
"package.json"
|
||||
@@ -9,7 +9,7 @@
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./src/index.ts"
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@uncaged/workflow-runtime",
|
||||
"version": "0.3.21",
|
||||
"version": "0.3.24",
|
||||
"files": [
|
||||
"dist",
|
||||
"package.json"
|
||||
@@ -24,7 +24,7 @@
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./src/index.ts"
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@uncaged/workflow-template-develop",
|
||||
"version": "0.3.21",
|
||||
"version": "0.3.24",
|
||||
"files": [
|
||||
"dist",
|
||||
"package.json"
|
||||
@@ -9,7 +9,7 @@
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./src/index.ts"
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@uncaged/workflow-template-solve-issue",
|
||||
"version": "0.3.21",
|
||||
"version": "0.3.24",
|
||||
"files": [
|
||||
"dist",
|
||||
"package.json"
|
||||
@@ -9,7 +9,7 @@
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./src/index.ts"
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
{
|
||||
"name": "@uncaged/workflow-util-agent",
|
||||
"version": "0.3.21",
|
||||
"version": "0.3.24",
|
||||
"files": [
|
||||
"dist",
|
||||
"package.json"
|
||||
],
|
||||
"type": "module",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./src/index.ts",
|
||||
"default": "./src/index.ts"
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@uncaged/workflow-util",
|
||||
"version": "0.3.21",
|
||||
"version": "0.3.24",
|
||||
"files": [
|
||||
"dist",
|
||||
"package.json"
|
||||
@@ -9,7 +9,7 @@
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./src/index.ts"
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Publish all public @uncaged/* packages to Gitea npm registry.
|
||||
#
|
||||
# PITFALL: After bumping versions in package.json, bun pm pack still reads the
|
||||
# old bun.lock and resolves workspace:* to the previous (stale) versions.
|
||||
# This script deletes bun.lock and runs bun install before packing to force
|
||||
# correct resolution of workspace:* dependencies.
|
||||
#
|
||||
# Usage:
|
||||
# ./scripts/publish-all.sh # Publish all packages
|
||||
# ./scripts/publish-all.sh --dry-run # Show what would be published
|
||||
#
|
||||
# Package order is auto-resolved via topological sort of workspace:* dependencies.
|
||||
#
|
||||
# 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/uncaged/npm/"
|
||||
DRY_RUN=""
|
||||
|
||||
if [[ "${1:-}" == "--dry-run" ]]; then
|
||||
DRY_RUN="--dry-run"
|
||||
echo "🔍 Dry run mode — no packages will be published"
|
||||
echo
|
||||
fi
|
||||
|
||||
# Topological sort: read all package.json files, build dependency graph, emit leaf-first order
|
||||
ORDERED=$(python3 -c "
|
||||
import json, os, sys
|
||||
from pathlib import Path
|
||||
|
||||
pkgs_dir = Path('$MONOREPO_ROOT/packages')
|
||||
# name -> dir_name, and dependency edges
|
||||
name_to_dir = {}
|
||||
deps_graph = {} # name -> set of @uncaged/* dependency names
|
||||
|
||||
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/'):
|
||||
continue
|
||||
if data.get('private'):
|
||||
continue
|
||||
name_to_dir[name] = d.name
|
||||
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 or ver == 'workspace:*':
|
||||
local_deps.add(dep)
|
||||
deps_graph[name] = local_deps
|
||||
|
||||
# Kahn's algorithm
|
||||
in_degree = {n: 0 for n in deps_graph}
|
||||
for n, ds in deps_graph.items():
|
||||
for d in ds:
|
||||
if d in in_degree:
|
||||
in_degree[d] = in_degree.get(d, 0) # ensure exists
|
||||
|
||||
# Recount
|
||||
in_degree = {n: 0 for n in deps_graph}
|
||||
for n, ds in deps_graph.items():
|
||||
for d in ds:
|
||||
if d in in_degree:
|
||||
in_degree[d] += 1
|
||||
|
||||
# Wait, direction is wrong. If A depends on B, B must be published first.
|
||||
# So edge is: A -> B means B must come before A.
|
||||
# in_degree[A] = number of deps A has (that are in our set)
|
||||
in_degree = {n: 0 for n in deps_graph}
|
||||
for n, ds in deps_graph.items():
|
||||
for d in ds:
|
||||
if d in in_degree:
|
||||
pass # d is a dependency of n
|
||||
in_degree[n] = len([d for d in ds if d in deps_graph])
|
||||
|
||||
queue = [n for n, deg in in_degree.items() if deg == 0]
|
||||
queue.sort() # stable order
|
||||
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()
|
||||
|
||||
for name in result:
|
||||
print(name_to_dir[name])
|
||||
")
|
||||
|
||||
# Regenerate lockfile so bun pm pack resolves workspace:* to freshly-bumped versions
|
||||
cd "$MONOREPO_ROOT"
|
||||
rm -f bun.lock
|
||||
bun install
|
||||
|
||||
ok=0
|
||||
fail=0
|
||||
|
||||
while IFS= read -r pkg; do
|
||||
dir="$MONOREPO_ROOT/packages/$pkg"
|
||||
name=$(grep -m1 '"name"' "$dir/package.json" | sed 's/.*: *"\(.*\)".*/\1/')
|
||||
|
||||
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 "❌ $name — pack failed"
|
||||
((fail++)) || true
|
||||
continue
|
||||
fi
|
||||
|
||||
if npm publish "$tgz" --registry="$REGISTRY" $DRY_RUN 2>&1 | tail -1 | grep -q '+'; then
|
||||
echo "✅ $name"
|
||||
((ok++)) || true
|
||||
else
|
||||
echo "⚠️ $name (may already exist at this version)"
|
||||
fi
|
||||
|
||||
rm -f "$tgz"
|
||||
done <<< "$ORDERED"
|
||||
|
||||
echo
|
||||
echo "Published: $ok Skipped/Failed: $fail"
|
||||
+101
-50
@@ -1,19 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
# publish.sh — Bump version & publish all @uncaged/workflow-* packages
|
||||
# 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 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
|
||||
# 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}" # needed by .npmrc
|
||||
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() {
|
||||
@@ -32,10 +44,10 @@ bump_version() {
|
||||
}
|
||||
|
||||
CURRENT=$(current_version)
|
||||
VERSION=$(bump_version "$CURRENT" "${1:?Usage: publish.sh <version|patch|minor|major>}")
|
||||
VERSION=$(bump_version "$CURRENT" "${1:?Usage: publish.sh [--dry-run] <version|patch|minor|major>}")
|
||||
echo "📦 Publish: $CURRENT → $VERSION"
|
||||
|
||||
# ─── Bump version ────────────────────────────────────────────────────────────
|
||||
# ─── Bump version ─────────────────────────────────────────────────────────────
|
||||
echo "🔢 Bumping versions..."
|
||||
for dir in packages/*/; do
|
||||
pkg="$dir/package.json"
|
||||
@@ -50,28 +62,62 @@ for dir in packages/*/; do
|
||||
"
|
||||
done
|
||||
|
||||
# ─── Replace workspace:* ─────────────────────────────────────────────────────
|
||||
echo "🔗 Replacing workspace:* → $VERSION..."
|
||||
for dir in packages/*/; do
|
||||
pkg="$dir/package.json"
|
||||
[[ -f "$pkg" ]] || continue
|
||||
node -e "
|
||||
const fs = require('fs');
|
||||
const p = JSON.parse(fs.readFileSync('$pkg','utf8'));
|
||||
let c = false;
|
||||
for (const k of ['dependencies','peerDependencies','devDependencies']) {
|
||||
if (!p[k]) continue;
|
||||
for (const [n, v] of Object.entries(p[k])) {
|
||||
if (n.startsWith('@uncaged/') && v === 'workspace:*') { p[k][n] = '$VERSION'; c = true; }
|
||||
}
|
||||
}
|
||||
if (c) 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
|
||||
|
||||
# ─── Build ───────────────────────────────────────────────────────────────────
|
||||
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 == '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..."
|
||||
npm run build
|
||||
bun run build
|
||||
|
||||
# ─── Self-test ────────────────────────────────────────────────────────────────
|
||||
echo "🧪 Running tests..."
|
||||
@@ -80,30 +126,35 @@ if ! bun test; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ─── Publish (delegate to publish-all.sh) ────────────────────────────────────
|
||||
echo "🚀 Publishing via publish-all.sh..."
|
||||
"$REPO_ROOT/scripts/publish-all.sh"
|
||||
# ─── Publish (bun resolves workspace:* for publish) ──────────────────────────
|
||||
echo "🚀 Publishing to $REGISTRY ..."
|
||||
ok=0
|
||||
fail=0
|
||||
|
||||
# ─── Restore workspace:* ─────────────────────────────────────────────────────
|
||||
echo "🔄 Restoring workspace:*..."
|
||||
for dir in packages/*/; do
|
||||
pkg="$dir/package.json"
|
||||
[[ -f "$pkg" ]] || continue
|
||||
node -e "
|
||||
const fs = require('fs');
|
||||
const p = JSON.parse(fs.readFileSync('$pkg','utf8'));
|
||||
let c = false;
|
||||
for (const k of ['dependencies','peerDependencies','devDependencies']) {
|
||||
if (!p[k]) continue;
|
||||
for (const [n, v] of Object.entries(p[k])) {
|
||||
if (n.startsWith('@uncaged/') && v === '$VERSION') { p[k][n] = 'workspace:*'; c = true; }
|
||||
}
|
||||
}
|
||||
if (c) fs.writeFileSync('$pkg', JSON.stringify(p, null, 2) + '\n');
|
||||
"
|
||||
done
|
||||
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
|
||||
|
||||
# ─── Commit ──────────────────────────────────────────────────────────────────
|
||||
echo "📝 Committing..."
|
||||
git add -A
|
||||
git commit -m "chore: publish v${VERSION}
|
||||
|
||||
Reference in New Issue
Block a user