diff --git a/.npmrc b/.npmrc index c7513ad4..4f51e760 100644 --- a/.npmrc +++ b/.npmrc @@ -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 diff --git a/scripts/fix-npmrc-all-repos.sh b/scripts/fix-npmrc-all-repos.sh index 2a55677f..b382dc0d 100644 --- a/scripts/fix-npmrc-all-repos.sh +++ b/scripts/fix-npmrc-all-repos.sh @@ -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 "" diff --git a/scripts/gitea/publish-local-packages.sh b/scripts/gitea/publish-local-packages.sh index f572b920..c7d23036 100644 --- a/scripts/gitea/publish-local-packages.sh +++ b/scripts/gitea/publish-local-packages.sh @@ -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:-}"