refactor(v2): Switch from inquirer to prompts (#4091)

Signed-off-by: Reece Dunham <me@rdil.rocks>
This commit is contained in:
Reece Dunham 2021-01-27 10:53:43 -05:00 committed by GitHub
parent b49ff32417
commit 95f81d2a44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 23 deletions

View file

@ -71,7 +71,6 @@
"@crowdin/cli": "^3.5.2",
"@types/express": "^4.17.2",
"@types/fs-extra": "^9.0.4",
"@types/inquirer": "^6.5.0",
"@types/jest": "^25.2.1",
"@types/loader-utils": "^1.1.3",
"@types/lodash.camelcase": "^4.3.6",

View file

@ -77,7 +77,6 @@
"html-tags": "^3.1.0",
"html-webpack-plugin": "^4.5.0",
"import-fresh": "^3.3.0",
"inquirer": "^7.2.0",
"is-root": "^2.1.0",
"joi": "^17.2.1",
"leven": "^3.1.0",
@ -93,6 +92,7 @@
"pnp-webpack-plugin": "^1.6.4",
"postcss-loader": "^4.1.0",
"postcss-preset-env": "^6.7.0",
"prompts": "^2.4.0",
"react-dev-utils": "^10.2.1",
"react-helmet": "^6.1.0",
"react-loadable": "^5.5.0",

View file

@ -14,7 +14,7 @@ import {execSync} from 'child_process';
import detect from 'detect-port';
import isRoot from 'is-root';
import chalk from 'chalk';
import inquirer from 'inquirer';
import prompts from 'prompts';
const isInteractive = process.stdout.isTTY;
@ -101,7 +101,7 @@ export default async function choosePort(
if (isInteractive) {
clearConsole();
const existingProcess = getProcessForPort(defaultPort);
const question: Record<string, unknown> = {
const question: prompts.PromptObject = {
type: 'confirm',
name: 'shouldChangePort',
message: `${chalk.yellow(
@ -109,10 +109,10 @@ export default async function choosePort(
existingProcess ? ` Probably:\n ${existingProcess}` : ''
}`,
)}\n\nWould you like to run the app on another port instead?`,
default: true,
initial: true,
};
inquirer.prompt(question).then((answer: any) => {
if (answer.shouldChangePort) {
prompts(question).then((answer: any) => {
if (answer.shouldChangePort === true) {
resolve(port);
} else {
resolve(null);

View file

@ -3338,14 +3338,6 @@
dependencies:
"@types/node" "*"
"@types/inquirer@^6.5.0":
version "6.5.0"
resolved "https://registry.yarnpkg.com/@types/inquirer/-/inquirer-6.5.0.tgz#b83b0bf30b88b8be7246d40e51d32fe9d10e09be"
integrity sha512-rjaYQ9b9y/VFGOpqBEXRavc3jh0a+e6evAbI31tMda8VlPaSy0AZJfXsvmIe3wklc7W6C3zCSfleuMXR7NOyXw==
dependencies:
"@types/through" "*"
rxjs "^6.4.0"
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff"
@ -3706,13 +3698,6 @@
resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.6.tgz#a9ca4b70a18b270ccb2bc0aaafefd1d486b7ea74"
integrity sha512-W+bw9ds02rAQaMvaLYxAbJ6cvguW/iJXNT6lTssS1ps6QdrMKttqEAMEG/b5CR8TZl3/L7/lH0ZV5nNR1LXikA==
"@types/through@*":
version "0.0.30"
resolved "https://registry.yarnpkg.com/@types/through/-/through-0.0.30.tgz#e0e42ce77e897bd6aead6f6ea62aeb135b8a3895"
integrity sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==
dependencies:
"@types/node" "*"
"@types/uglify-js@*":
version "3.0.5"
resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-3.0.5.tgz#2c70d5c68f6e002e3b2e4f849adc5f162546f633"
@ -10922,7 +10907,7 @@ inquirer@^6.2.0, inquirer@^6.5.1:
strip-ansi "^5.1.0"
through "^2.3.6"
inquirer@^7.0.0, inquirer@^7.2.0:
inquirer@^7.0.0:
version "7.2.0"
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.2.0.tgz#63ce99d823090de7eb420e4bb05e6f3449aa389a"
integrity sha512-E0c4rPwr9ByePfNlTIB8z51kK1s2n6jrHuJeEHENl/sbq2G/S1auvibgEwNR4uSyiU+PiYHqSwsgGiXjG8p5ZQ==