From c16c500d712ec98f5768eea0c73ee32ab93f310f Mon Sep 17 00:00:00 2001 From: bea-claude Date: Tue, 3 Nov 2026 16:52:38 +0000 Subject: [PATCH] fix(cli): BE_NPM_CHECK asks for an npm alias's real package, not the alias A dependency such as "@beplus/docs-legacy": "npm:@beplus/docs@0.4.2" is fetched as @beplus/docs, but the check asked the registry for @beplus/docs-legacy, got a 404 and failed the job (Mountaineer's console, ironmountain-cz/monorepo#563). It now reads the package after `npm:`, and skips an alias to a package outside @beplus. Co-Authored-By: Igor Lamos --- cli/README.md | 4 +++- cli/action.yml | 13 +++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cli/README.md b/cli/README.md index bcb8e6c..a3a4f4d 100644 --- a/cli/README.md +++ b/cli/README.md @@ -98,7 +98,9 @@ and pnpm fails minutes later with `ERR_PNPM_TARBALL_INTEGRITY`, then `BE_NPM_CHECK` closes that gap. After the auth, it asks the registry for every `@beplus` dependency of the packages you name (`dependencies`, -`devDependencies`, `optionalDependencies`; `workspace:` ones are skipped) — +`devDependencies`, `optionalDependencies`; `workspace:` ones are skipped, and an +npm alias such as `"@beplus/docs-legacy": "npm:@beplus/docs@0.4.2"` is asked for +as the package after `npm:`) — through the registry Rush hands pnpm (`common/config/rush/.npmrc`), else npm's own — and fails the step unless each comes back as a real package, naming the cause: the stub (no token, or a refused one), or npm's own error (a 404 for a diff --git a/cli/action.yml b/cli/action.yml index 91a1089..5f0da60 100644 --- a/cli/action.yml +++ b/cli/action.yml @@ -205,8 +205,11 @@ runs: [ "$registry" != undefined ] || registry="npm's default registry (nothing maps @beplus)" fi - # Each package's direct @beplus dependencies. A workspace project is - # built, not fetched. + # Each package's direct @beplus dependencies, by the package the registry + # serves: an npm alias (`"@beplus/docs-legacy": "npm:@beplus/docs@0.4.2"`) + # is fetched as the package after `npm:`, so that is the one to ask for, + # and an alias to a package outside @beplus is not ours to check. A + # workspace project is built, not fetched. deps="" for dir in $CHECK; do if [ ! -f "$dir/package.json" ]; then @@ -216,8 +219,10 @@ runs: deps+="$(jq -r ' [.dependencies, .devDependencies, .optionalDependencies] | map(objects | to_entries[]) | .[] - | select((.key | startswith("@beplus/")) and ((.value | tostring) | startswith("workspace:") | not)) - | .key' "$dir/package.json")"$'\n' + | (.value | tostring) as $spec + | select($spec | startswith("workspace:") | not) + | (if ($spec | startswith("npm:")) then ($spec | capture("^npm:(?@?[^@]+)").name) else .key end) + | select(startswith("@beplus/"))' "$dir/package.json")"$'\n' done mapfile -t wanted < <(printf '%s' "$deps" | sed '/^$/d' | sort -u) if [ "${#wanted[@]}" -eq 0 ]; then