fix: standardize common-plat .npmrc + publish script for corp network
- .npmrc: use ${GITEA_NPM_HOST:-localhost}:3300 (was hardcoded gitea.bytelyst.com)
- publish-local-packages.sh: use ${GITEA_NPM_HOST:-localhost}:3300 fallback
- fix-npmrc-all-repos.sh: add common-plat to repo list, skip self for
workspace link, add nested .npmrc scanning (e.g. dashboard/.npmrc)
This commit is contained in:
parent
7208506412
commit
a107b2e342
8
.npmrc
8
.npmrc
@ -1,3 +1,5 @@
|
|||||||
@bytelyst:registry=https://gitea.bytelyst.com/api/packages/ByteLyst/npm/
|
@bytelyst:registry=http://${GITEA_NPM_HOST:-localhost}:3300/api/packages/ByteLyst/npm/
|
||||||
//gitea.bytelyst.com/api/packages/ByteLyst/npm/:_authToken=${GITEA_NPM_TOKEN}
|
//localhost:3300/api/packages/ByteLyst/npm/:_authToken=${GITEA_NPM_TOKEN}
|
||||||
strict-ssl=true
|
strict-ssl=false
|
||||||
|
link-workspace-packages=true
|
||||||
|
prefer-workspace-packages=true
|
||||||
|
|||||||
@ -32,6 +32,7 @@ fi
|
|||||||
# All repos that use @bytelyst/* packages
|
# All repos that use @bytelyst/* packages
|
||||||
REPOS=(
|
REPOS=(
|
||||||
learning_ai_clock
|
learning_ai_clock
|
||||||
|
learning_ai_common_plat
|
||||||
learning_ai_efforise
|
learning_ai_efforise
|
||||||
learning_ai_fastgap
|
learning_ai_fastgap
|
||||||
learning_ai_flowmonk
|
learning_ai_flowmonk
|
||||||
@ -45,6 +46,11 @@ REPOS=(
|
|||||||
learning_multimodal_memory_agents
|
learning_multimodal_memory_agents
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Minimal template for nested .npmrc (e.g. dashboard/.npmrc inside a repo)
|
||||||
|
NPMRC_NESTED_TEMPLATE='@bytelyst:registry=http://${GITEA_NPM_HOST:-localhost}:3300/api/packages/ByteLyst/npm/
|
||||||
|
//localhost:3300/api/packages/ByteLyst/npm/:_authToken=${GITEA_NPM_TOKEN}
|
||||||
|
strict-ssl=false'
|
||||||
|
|
||||||
NPMRC_TEMPLATE='@bytelyst:registry=http://${GITEA_NPM_HOST:-localhost}:3300/api/packages/ByteLyst/npm/
|
NPMRC_TEMPLATE='@bytelyst:registry=http://${GITEA_NPM_HOST:-localhost}:3300/api/packages/ByteLyst/npm/
|
||||||
//localhost:3300/api/packages/ByteLyst/npm/:_authToken=${GITEA_NPM_TOKEN}
|
//localhost:3300/api/packages/ByteLyst/npm/:_authToken=${GITEA_NPM_TOKEN}
|
||||||
strict-ssl=false
|
strict-ssl=false
|
||||||
@ -90,8 +96,9 @@ for repo in "${REPOS[@]}"; do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# ── Fix pnpm-workspace.yaml ─────────────────────────────
|
# ── Fix pnpm-workspace.yaml ─────────────────────────────
|
||||||
|
# (skip common-plat itself — it IS the workspace source)
|
||||||
workspace_file="$repo_path/pnpm-workspace.yaml"
|
workspace_file="$repo_path/pnpm-workspace.yaml"
|
||||||
if [ -f "$workspace_file" ]; then
|
if [ -f "$workspace_file" ] && [ "$repo" != "learning_ai_common_plat" ]; then
|
||||||
if ! grep -q "learning_ai_common_plat" "$workspace_file"; then
|
if ! grep -q "learning_ai_common_plat" "$workspace_file"; then
|
||||||
if $DRY_RUN; then
|
if $DRY_RUN; then
|
||||||
echo "📝 $repo/pnpm-workspace.yaml — would add common-plat link"
|
echo "📝 $repo/pnpm-workspace.yaml — would add common-plat link"
|
||||||
@ -104,6 +111,20 @@ for repo in "${REPOS[@]}"; do
|
|||||||
echo "✓ $repo/pnpm-workspace.yaml — already has common-plat link"
|
echo "✓ $repo/pnpm-workspace.yaml — already has common-plat link"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# ── Fix nested .npmrc files (e.g. dashboard/.npmrc) ────
|
||||||
|
while IFS= read -r nested_npmrc; do
|
||||||
|
if grep -q "gitea.bytelyst.com" "$nested_npmrc"; then
|
||||||
|
rel_path="${nested_npmrc#$repo_path/}"
|
||||||
|
if $DRY_RUN; then
|
||||||
|
echo "📝 $repo/$rel_path — would replace hardcoded gitea.bytelyst.com"
|
||||||
|
else
|
||||||
|
echo -e "$NPMRC_NESTED_TEMPLATE" > "$nested_npmrc"
|
||||||
|
echo "✅ $repo/$rel_path — fixed"
|
||||||
|
fi
|
||||||
|
((fixed_npmrc++))
|
||||||
|
fi
|
||||||
|
done < <(find "$repo_path" -name ".npmrc" -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "$repo_path/.npmrc" 2>/dev/null)
|
||||||
done
|
done
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
@ -4,7 +4,7 @@ set -euo pipefail
|
|||||||
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||||
PACKAGES_DIR="$REPO_ROOT/packages"
|
PACKAGES_DIR="$REPO_ROOT/packages"
|
||||||
TMP_DIR="${TMPDIR:-/tmp}/bytelyst-gitea-publish"
|
TMP_DIR="${TMPDIR:-/tmp}/bytelyst-gitea-publish"
|
||||||
REGISTRY_URL="${GITEA_NPM_REGISTRY_URL:-https://gitea.bytelyst.com/api/packages/ByteLyst/npm/}"
|
REGISTRY_URL="${GITEA_NPM_REGISTRY_URL:-http://${GITEA_NPM_HOST:-localhost}:3300/api/packages/ByteLyst/npm/}"
|
||||||
AUTH_TARGET="${REGISTRY_URL#http://}"
|
AUTH_TARGET="${REGISTRY_URL#http://}"
|
||||||
AUTH_TARGET="${AUTH_TARGET#https://}"
|
AUTH_TARGET="${AUTH_TARGET#https://}"
|
||||||
TOKEN="${GITEA_NPM_TOKEN:-}"
|
TOKEN="${GITEA_NPM_TOKEN:-}"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user