Improve the profiler-cli publish script and document the whole deployment in a better way - #6260
Open
canova wants to merge 4 commits into
Open
Improve the profiler-cli publish script and document the whole deployment in a better way#6260canova wants to merge 4 commits into
canova wants to merge 4 commits into
Conversation
…stry Yarn 1 sets npm_config_registry to https://registry.yarnpkg.com in the environment of every script it runs. The npm publish spawned by this script inherited that and tried to upload to the Yarn mirror, which is read-only and doesn't receive the token that ~/.npmrc scopes to registry.npmjs.org, so the publish failed to authenticate. Fixed this issue by setting publishConfig.registry in package.json, which npm applies at publish time regardless of how it was invoked, and by dropping the inherited npm_* variables when the script spawns npm so it sees the same environment it would in a plain shell.
npm publish needs a token in ~/.npmrc to start at all, and fails with ENEEDAUTH instead of offering to log you in, so a stale token would only surface after yarn test-all had already run. Check npm whoami up front and run npm login when it fails, which keeps the interactive part at the beginning and skips it when the existing token is still good. The browser round trip npm makes at publish time is the 2FA check on the upload itself and still happens either way.
yarn build-cli bundles the working copy rather than a commit, so anything uncommitted at publish time ends up in the tarball on npm with no commit or tag matching what users install. Check `git status --porcelain` before the npm login and the test run, print what is dirty and stop there. Untracked files count too, since a source file that isn't committed yet still gets bundled.
The deploying document was outdated a bit since we added the cli and changed the deployment process for a few times. This commit reorganizes the file a bit so we have the whole step indicated properly and with the proper release order. And it also adds a step by step list at the top summarizes everything.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6260 +/- ##
=======================================
Coverage 83.73% 83.73%
=======================================
Files 350 350
Lines 37523 37524 +1
Branches 10543 10552 +9
=======================================
+ Hits 31420 31421 +1
Misses 5676 5676
Partials 427 427 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Main | Deploy preview
Previously the
yarn publish-cliwasn't working properly, and that's why I had to usenpm publish ...manually every time, but that's quite prone to errors. I improved that script and updated the whole documentation so it's easier to follow.These are the things I did, please look at their own commits to see their details:
scripts/publish-profiler-cli.mjsscript:npm publishfails)Since I didn't want to publish to our own npmjs package while testing, I used a local verdaccio server to host it and verified that the script indeed works now.
Also it looks like there are a lot more changes made than it actually is in deploying.md, mostly because some sections are shifted around and git can't figure that out.