[scripts] Bug Fix: Let npm prompt for OTP when publishing bootstrap stubs#8820
Open
etrepum wants to merge 3 commits into
Open
[scripts] Bug Fix: Let npm prompt for OTP when publishing bootstrap stubs#8820etrepum wants to merge 3 commits into
etrepum wants to merge 3 commits into
Conversation
…tubs ## Description `setup-trusted-publishing.mjs --bootstrap` fails with `npm error code EOTP` when publishing a placeholder stub for a new package (e.g. `@lexical/mdast`). `publishStub` ran `npm publish` (and the follow-up `npm deprecate`) through the captured `exec()` helper, which pipes all stdio; npm only attempts its interactive OTP / web-auth recovery when both stdin and stdout are TTYs, so the publish failed hard instead of prompting for authentication. This routes both commands through `runNpm` — which the rest of the script already uses for exactly this reason — adding a `cwd` option so `npm publish` can run from the stub's temp directory. npm now prints the web-auth URL and waits, and "Skip two-factor authentication for the next 5 minutes" covers the rest of the run. `runNpm` also strips the pnpm-only `npm_config_*` env vars, silencing npm 11+'s "Unknown env config" warnings during the publish. ## Test plan ### Before `pnpm run setup-trusted-publishing --bootstrap --package @lexical/mdast` fails at the stub publish with `npm error code EOTP` / "This operation requires a one-time password" without ever prompting. ### After The same command prints "Publishing @lexical/mdast@0.0.0-bootstrap.0 (npm may prompt for OTP / web auth):" and npm's interactive web-auth flow proceeds. Verified `--bootstrap --dry-run` still short-circuits before publishing, and `node --check`, prettier, and eslint pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Description
setup-trusted-publishing.mjs --bootstrapfails withnpm error code EOTPwhen publishing a placeholder stub for a new package (e.g.@lexical/mdast).publishStubrannpm publish(and the follow-upnpm deprecate) through the capturedexec()helper, which pipes all stdio; npm only attempts its interactive OTP / web-auth recovery when both stdin and stdout are TTYs, so the publish failed hard instead of prompting for authentication.This routes both commands through
runNpm— which the rest of the script already uses for exactly this reason — adding acwdoption sonpm publishcan run from the stub's temp directory. npm now prints the web-auth URL and waits, and "Skip two-factor authentication for the next 5 minutes" covers the rest of the run.runNpmalso strips the pnpm-onlynpm_config_*env vars, silencing npm 11+'s "Unknown env config" warnings during the publish.Test plan
Before
pnpm run setup-trusted-publishing --bootstrap --package @lexical/mdastfails at the stub publish withnpm error code EOTP/ "This operation requires a one-time password" without ever prompting.After
The same command prints "Publishing @lexical/mdast@0.0.0-bootstrap.0 (npm may prompt for OTP / web auth):" and npm's interactive web-auth flow proceeds. Verified
--bootstrap --dry-runstill short-circuits before publishing, andnode --check, prettier, and eslint pass.