Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace inquirer with prompts #10083

Merged
merged 1 commit into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions packages/create-react-app/createReactApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const envinfo = require('envinfo');
const execSync = require('child_process').execSync;
const fs = require('fs-extra');
const hyperquest = require('hyperquest');
const inquirer = require('inquirer');
const prompts = require('prompts');
const os = require('os');
const path = require('path');
const semver = require('semver');
Expand Down Expand Up @@ -604,20 +604,18 @@ function getInstallPackage(version, originalDirectory) {

for (const script of scriptsToWarn) {
if (packageToInstall.startsWith(script.name)) {
return inquirer
.prompt({
type: 'confirm',
name: 'useScript',
message: script.message,
default: false,
})
.then(answer => {
if (!answer.useScript) {
process.exit(0);
}
return prompts({
type: 'confirm',
name: 'useScript',
message: script.message,
initial: false,
}).then(answer => {
if (!answer.useScript) {
process.exit(0);
}

return packageToInstall;
});
return packageToInstall;
});
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/create-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"envinfo": "7.7.3",
"fs-extra": "9.0.1",
"hyperquest": "2.1.3",
"inquirer": "7.3.3",
"prompts": "2.4.0",
"semver": "7.3.2",
"tar-pack": "3.4.1",
"tmp": "0.2.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/react-dev-utils/WebpackDevServerUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const url = require('url');
const chalk = require('chalk');
const detect = require('detect-port-alt');
const isRoot = require('is-root');
const inquirer = require('inquirer');
const prompts = require('prompts');
const clearConsole = require('./clearConsole');
const formatWebpackMessages = require('./formatWebpackMessages');
const getProcessForPort = require('./getProcessForPort');
Expand Down Expand Up @@ -467,9 +467,9 @@ function choosePort(host, defaultPort) {
message +
`${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 => {
prompts(question).then(answer => {
if (answer.shouldChangePort) {
resolve(port);
} else {
Expand Down
6 changes: 3 additions & 3 deletions packages/react-dev-utils/browsersHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
const browserslist = require('browserslist');
const chalk = require('chalk');
const os = require('os');
const inquirer = require('inquirer');
const prompts = require('prompts');
const pkgUp = require('pkg-up');
const fs = require('fs');

Expand All @@ -35,10 +35,10 @@ function shouldSetBrowsers(isInteractive) {
`\n\nWould you like to add the defaults to your ${chalk.bold(
'package.json'
)}?`,
default: true,
initial: true,
};

return inquirer.prompt(question).then(answer => answer.shouldSetBrowsers);
return prompts(question).then(answer => answer.shouldSetBrowsers);
}

function checkBrowsers(dir, isInteractive, retry = true) {
Expand Down
12 changes: 0 additions & 12 deletions packages/react-dev-utils/inquirer.js

This file was deleted.

3 changes: 1 addition & 2 deletions packages/react-dev-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"ignoredFiles.js",
"immer.js",
"InlineChunkHtmlPlugin.js",
"inquirer.js",
"InterpolateHtmlPlugin.js",
"launchEditor.js",
"launchEditorEndpoint.js",
Expand Down Expand Up @@ -67,7 +66,7 @@
"globby": "11.0.1",
"gzip-size": "5.1.1",
"immer": "7.0.9",
"inquirer": "7.3.3",
"prompts": "2.4.0",
"is-root": "2.1.0",
"loader-utils": "2.0.0",
"open": "^7.0.2",
Expand Down
1 change: 1 addition & 0 deletions packages/react-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"postcss-normalize": "8.0.1",
"postcss-preset-env": "6.7.0",
"postcss-safe-parser": "5.0.2",
"prompts": "2.4.0",
"react-app-polyfill": "^2.0.0",
"react-dev-utils": "^11.0.0",
"react-refresh": "^0.8.3",
Expand Down
Loading