fix(publish): use npm publish so the auth token actually gets used#43
Merged
Merged
Conversation
#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>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Follow-up to #41. After pinning yarn's registry to
npmjs.org, the v0.1.0-alpha.29 publish still failed:yarn publishis not picking up the_authTokenentry thatnpm config set //registry.npmjs.org/:_authToken "$NPM_TOKEN"writes at the top ofbin/publish-npm— so the PUT goes out unauthenticated and the npm registry replies with 404 (instead of 401). Verified locally that unauthenticatedcurl -X PUT https://registry.npmjs.org/@sfcompute%2fnodes-sdk-alphareturns 404.Description of changes
Swap
yarn publishfornpm publishinbin/publish-npm.npm publishreads the same~/.npmrcthatnpm config setpopulated, so the bearer token actually goes out with the request.package.jsonalready haspublishConfig.access = "public", so no--access publicflag is needed.Testing
Like #41 — can only be exercised in CI. After this lands:
main(HEAD has the rightversion: 0.1.0-alpha.29).npm view @sfcompute/nodes-sdk-alpha version— should jump from0.1.0-alpha.27to0.1.0-alpha.29.Review Callouts
yarn publishto registry.npmjs.org #41 because yarn 1.x publish doesn't respect the npm authToken format the script writes.npm publishwill fail with a clear401 Unauthorizedinstead of a misleading 404.Tag
@indentto continue the conversation here.