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:
saravanakumardb1 2026-04-13 10:51:12 -07:00
parent 7208506412
commit a107b2e342
3 changed files with 28 additions and 5 deletions

8
.npmrc
View File

@ -1,3 +1,5 @@
@bytelyst:registry=https://gitea.bytelyst.com/api/packages/ByteLyst/npm/
//gitea.bytelyst.com/api/packages/ByteLyst/npm/:_authToken=${GITEA_NPM_TOKEN}
strict-ssl=true
@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
link-workspace-packages=true
prefer-workspace-packages=true

View File

@ -32,6 +32,7 @@ fi
# All repos that use @bytelyst/* packages
REPOS=(
learning_ai_clock
learning_ai_common_plat
learning_ai_efforise
learning_ai_fastgap
learning_ai_flowmonk
@ -45,6 +46,11 @@ REPOS=(
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/
//localhost:3300/api/packages/ByteLyst/npm/:_authToken=${GITEA_NPM_TOKEN}
strict-ssl=false
@ -90,8 +96,9 @@ for repo in "${REPOS[@]}"; do
fi
# ── Fix pnpm-workspace.yaml ─────────────────────────────
# (skip common-plat itself — it IS the workspace source)
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 $DRY_RUN; then
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"
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
echo ""

View File

@ -4,7 +4,7 @@ set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
PACKAGES_DIR="$REPO_ROOT/packages"
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="${AUTH_TARGET#https://}"
TOKEN="${GITEA_NPM_TOKEN:-}"