From 763ff22bae456e24fad87991851e904e4446d9f5 Mon Sep 17 00:00:00 2001 From: bntvllnt <32437578+bntvllnt@users.noreply.github.com> Date: Mon, 31 Aug 2026 17:41:11 +0200 Subject: [PATCH] fix: parse npm 12 pack metadata --- .github/workflows/publish.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1ce7548..3dfcfd1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -81,8 +81,9 @@ jobs: npm version "$VERSION" --no-git-tag-version PACK_RESULT=$(npm pack --ignore-scripts --json --pack-destination "$RUNNER_TEMP") - TARBALL_NAME=$(echo "$PACK_RESULT" | node -e 'let input=""; process.stdin.on("data", chunk => input += chunk); process.stdin.on("end", () => console.log(JSON.parse(input)[0].filename))') - LOCAL_INTEGRITY=$(echo "$PACK_RESULT" | node -e 'let input=""; process.stdin.on("data", chunk => input += chunk); process.stdin.on("end", () => console.log(JSON.parse(input)[0].integrity))') + IFS=$'\t' read -r TARBALL_NAME LOCAL_INTEGRITY < <( + echo "$PACK_RESULT" | node -e 'let input=""; process.stdin.on("data", chunk => input += chunk); process.stdin.on("end", () => { const parsed = JSON.parse(input); const item = Array.isArray(parsed) ? parsed[0] : Object.values(parsed)[0]; if (!item?.filename || !item?.integrity) process.exit(1); console.log(`${item.filename}\t${item.integrity}`); })' + ) REMOTE_INTEGRITY=$(npm view "@vllnt/typescript@${VERSION}" dist.integrity 2>/dev/null || true) if [ -n "$REMOTE_INTEGRITY" ]; then @@ -136,8 +137,9 @@ jobs: unset NODE_AUTH_TOKEN PACK_RESULT=$(npm pack --ignore-scripts --json --pack-destination "$RUNNER_TEMP") - TARBALL_NAME=$(echo "$PACK_RESULT" | node -e 'let input=""; process.stdin.on("data", chunk => input += chunk); process.stdin.on("end", () => console.log(JSON.parse(input)[0].filename))') - LOCAL_INTEGRITY=$(echo "$PACK_RESULT" | node -e 'let input=""; process.stdin.on("data", chunk => input += chunk); process.stdin.on("end", () => console.log(JSON.parse(input)[0].integrity))') + IFS=$'\t' read -r TARBALL_NAME LOCAL_INTEGRITY < <( + echo "$PACK_RESULT" | node -e 'let input=""; process.stdin.on("data", chunk => input += chunk); process.stdin.on("end", () => { const parsed = JSON.parse(input); const item = Array.isArray(parsed) ? parsed[0] : Object.values(parsed)[0]; if (!item?.filename || !item?.integrity) process.exit(1); console.log(`${item.filename}\t${item.integrity}`); })' + ) REMOTE_INTEGRITY=$(npm view "@vllnt/typescript@${VERSION}" dist.integrity 2>/dev/null || true) if [ -n "$REMOTE_INTEGRITY" ]; then