mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
[compiler:publish] Prompt for OTP
Makes running the script a little more ergonomic by prompting for OTP upfront. ghstack-source-id: e9967bfde1ab01ff9417a848154743ae1926318d Pull Request resolved: https://github.com/facebook/react/pull/29149
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
"concurrently": "^7.4.0",
|
||||
"folder-hash": "^4.0.4",
|
||||
"ora": "5.4.1",
|
||||
"prompt-promise": "^1.0.3",
|
||||
"rollup": "^4.13.2",
|
||||
"rollup-plugin-banner2": "^1.2.3",
|
||||
"rollup-plugin-prettier": "^4.1.1",
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const prompt = require("prompt-promise");
|
||||
|
||||
const run = async () => {
|
||||
while (true) {
|
||||
const otp = await prompt("NPM 2-factor auth code: ");
|
||||
prompt.done();
|
||||
if (otp) {
|
||||
return otp;
|
||||
} else {
|
||||
console.error("\nTwo-factor auth is required to publish.");
|
||||
// (Ask again.)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = run;
|
||||
@@ -4,6 +4,7 @@ const path = require("path");
|
||||
const yargs = require("yargs");
|
||||
const util = require("util");
|
||||
const { hashElement } = require("folder-hash");
|
||||
const promptForOTP = require("./prompt-for-otp");
|
||||
|
||||
const PUBLISHABLE_PACKAGES = [
|
||||
"babel-plugin-react-compiler",
|
||||
@@ -145,6 +146,7 @@ async function main() {
|
||||
}
|
||||
|
||||
if (forReal === true) {
|
||||
const otp = await promptForOTP();
|
||||
const commit = await execHelper(
|
||||
"git show -s --no-show-signature --format=%h",
|
||||
{
|
||||
@@ -204,7 +206,7 @@ async function main() {
|
||||
try {
|
||||
await spawnHelper(
|
||||
"npm",
|
||||
[...opts, "--registry=https://registry.npmjs.org"],
|
||||
[...opts, "--registry=https://registry.npmjs.org", `--otp=${otp}`],
|
||||
{
|
||||
cwd: pkgDir,
|
||||
stdio: "inherit",
|
||||
|
||||
@@ -7456,6 +7456,11 @@ json5@^2.1.2, json5@^2.2.3:
|
||||
array-includes "^3.1.5"
|
||||
object.assign "^4.1.3"
|
||||
|
||||
keypress@~0.2.1:
|
||||
version "0.2.1"
|
||||
resolved "https://registry.yarnpkg.com/keypress/-/keypress-0.2.1.tgz#1e80454250018dbad4c3fe94497d6e67b6269c77"
|
||||
integrity sha512-HjorDJFNhnM4SicvaUXac0X77NiskggxJdesG72+O5zBKpSqKFCrqmndKVqpu3pFqkla0St6uGk8Ju0sCurrmg==
|
||||
|
||||
kind-of@^6.0.2:
|
||||
version "6.0.3"
|
||||
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd"
|
||||
@@ -7784,6 +7789,18 @@ nanoid@^3.3.6:
|
||||
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c"
|
||||
integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==
|
||||
|
||||
native-or-another@~2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/native-or-another/-/native-or-another-2.0.0.tgz#17a567f92beea9cd71acff96a7681a735eca3bff"
|
||||
integrity sha512-rDE50rrX/PSk2StV5EnwpRk35TENl4I4ZsSGZsMJufLdAJ1P4YzNwVf5UOhjQodwz+RdTP9eZSG7FiqnoY25nA==
|
||||
dependencies:
|
||||
native-or-bluebird "^1.1.2"
|
||||
|
||||
native-or-bluebird@^1.1.2:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/native-or-bluebird/-/native-or-bluebird-1.2.0.tgz#39c47bfd7825d1fb9ffad32210ae25daadf101c9"
|
||||
integrity sha512-0SH8UubxDfe382eYiwmd12qxAbiWGzlGZv6CkMA+DPojWa/Y0oH4hE0lRtFfFgJmPQFyKXeB8XxPbZz6TvvKaQ==
|
||||
|
||||
natural-compare@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
|
||||
@@ -8373,6 +8390,14 @@ pretty-format@^29.3.1, pretty-format@^29.5.0:
|
||||
ansi-styles "^5.0.0"
|
||||
react-is "^18.0.0"
|
||||
|
||||
prompt-promise@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/prompt-promise/-/prompt-promise-1.0.3.tgz#78ce4fcb9a14a108c49174f2d808c440d1bde265"
|
||||
integrity sha512-xIbGSzK59hFiwn9kmD0Cki4igpUqTVx7c6D8lqZoENAZyTwxhMhh/QleHWoRFVVusi7CTj/ByHP3N+2EmkhKIA==
|
||||
dependencies:
|
||||
keypress "~0.2.1"
|
||||
native-or-another "~2.0.0"
|
||||
|
||||
prompts@^2.0.1:
|
||||
version "2.4.2"
|
||||
resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069"
|
||||
|
||||
Reference in New Issue
Block a user