Skip to content

Commit 1495892

Browse files
fix: use npm publish so the auth token actually gets used (#43)
#41 fixed yarn's default registry but the v0.1.0-alpha.29 publish run still failed: + yarn publish --tag latest --registry https://registry.npmjs.org error Couldn't publish package: "https://registry.npmjs.org/@sfcompute%2fnodes-sdk-alpha: Not found" `yarn publish` is not picking up the `_authToken` entry that the script writes via `npm config set` at the top — the PUT request goes out unauthenticated and npm responds with 404. `npm publish` reads the same ~/.npmrc that `npm config set` wrote to, so it actually authenticates. publishConfig.access is already "public" in package.json so no flag is required. Generated with [Indent](https://indent.com) Co-authored-by: Indent <noreply@indent.com>
1 parent 36e044e commit 1495892

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

bin/publish-npm

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,11 @@ fi
5959

6060
# Publish with the appropriate tag
6161
#
62-
# Explicit --registry is required because yarn 1.x defaults to
63-
# https://registry.yarnpkg.com — a read-only npm mirror — and the auth
64-
# token above is configured for registry.npmjs.org, so the publish PUT
65-
# fails with "Not found". Recent runs (v0.1.0-alpha.28, v0.1.0-alpha.29)
66-
# failed for this reason.
67-
yarn publish --tag "$TAG" --registry https://registry.npmjs.org
62+
# We use `npm publish` rather than `yarn publish` so the script picks up
63+
# the `_authToken` written via `npm config set` above. yarn 1.x publish
64+
# silently ignores that auth entry (it issues PUT requests without the
65+
# bearer token, which npm replies to with 404), so the previous attempts
66+
# at v0.1.0-alpha.28 and v0.1.0-alpha.29 failed even after pinning the
67+
# registry. publishConfig.access is set to "public" in package.json, so
68+
# no --access flag is required.
69+
npm publish --tag "$TAG"

0 commit comments

Comments
 (0)