mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-03 16:59:06 +02:00
refactor(v2): Switch from inquirer to prompts (#4091)
Signed-off-by: Reece Dunham <me@rdil.rocks>
This commit is contained in:
parent
b49ff32417
commit
95f81d2a44
4 changed files with 7 additions and 23 deletions
|
@ -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",
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue