Skip to content

Commit

Permalink
chore: migrate to inquirer
Browse files Browse the repository at this point in the history
  • Loading branch information
anshumanv committed Mar 22, 2021
1 parent 5a3d3e2 commit 20cb5e0
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const getPackageManager = require('../get-package-manager');
jest.mock('../get-package-manager', () => jest.fn());
const globalModulesNpmValue = 'test-npm';
jest.setMock('global-modules', globalModulesNpmValue);
jest.setMock('enquirer', {
jest.setMock('inquirer', {
prompt: jest.fn(),
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const stripAnsi = require('strip-ansi');
const globalModulesNpmValue = 'test-npm';

jest.setMock('global-modules', globalModulesNpmValue);
jest.setMock('enquirer', { prompt: jest.fn() });
jest.setMock('inquirer', { prompt: jest.fn() });
jest.setMock('../run-command', jest.fn());
jest.setMock('../package-exists', jest.fn());
jest.setMock('../get-package-manager', jest.fn());
Expand All @@ -14,7 +14,7 @@ const getPackageManager = require('../get-package-manager');
const packageExists = require('../package-exists');
const promptInstallation = require('../prompt-installation');
const runCommand = require('../run-command');
const { prompt } = require('enquirer');
const { prompt } = require('inquirer');

describe('promptInstallation', () => {
beforeAll(() => {
Expand Down
6 changes: 3 additions & 3 deletions packages/webpack-cli/lib/utils/prompt-installation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { prompt } = require('enquirer');
const inquirer = require('inquirer');
const utils = require('./index');

/**
Expand All @@ -25,14 +25,14 @@ async function promptInstallation(packageName, preMessage) {
let installConfirm;

try {
({ installConfirm } = await prompt([
({ installConfirm } = await inquirer.prompt([
{
type: 'confirm',
name: 'installConfirm',
message: `Would you like to install '${colors.green(packageName)}' package? (That will run '${colors.green(
commandToBeRun,
)}')`,
initial: 'Y',
default: 'Y',
stdout: process.stderr,
},
]));
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
"@webpack-cli/serve": "^1.3.0",
"colorette": "^1.2.1",
"commander": "^7.0.0",
"enquirer": "^2.3.6",
"execa": "^5.0.0",
"fastest-levenshtein": "^1.0.12",
"import-local": "^3.0.2",
"inquirer": "^8.0.0",
"interpret": "^2.2.0",
"rechoir": "^0.7.0",
"v8-compile-cache": "^2.2.0",
Expand Down
26 changes: 26 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5982,6 +5982,25 @@ inquirer@^7.1.0, inquirer@^7.3.3:
strip-ansi "^6.0.0"
through "^2.3.6"

inquirer@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-8.0.0.tgz#957a46db1abcf0fdd2ab82deb7470e90afc7d0ac"
integrity sha512-ON8pEJPPCdyjxj+cxsYRe6XfCJepTxANdNnTebsTuQgXpRyZRRT9t4dJwjRubgmvn20CLSEnozRUayXyM9VTXA==
dependencies:
ansi-escapes "^4.2.1"
chalk "^4.1.0"
cli-cursor "^3.1.0"
cli-width "^3.0.0"
external-editor "^3.0.3"
figures "^3.0.0"
lodash "^4.17.21"
mute-stream "0.0.8"
run-async "^2.4.0"
rxjs "^6.6.6"
string-width "^4.1.0"
strip-ansi "^6.0.0"
through "^2.3.6"

internal-ip@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/internal-ip/-/internal-ip-4.3.0.tgz#845452baad9d2ca3b69c635a137acb9a0dad0907"
Expand Down Expand Up @@ -9512,6 +9531,13 @@ rxjs@>=6.4.0, rxjs@^6.3.3, rxjs@^6.4.0, rxjs@^6.6.0, rxjs@^6.6.3:
dependencies:
tslib "^1.9.0"

rxjs@^6.6.6:
version "6.6.6"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.6.tgz#14d8417aa5a07c5e633995b525e1e3c0dec03b70"
integrity sha512-/oTwee4N4iWzAMAL9xdGKjkEHmIwupR3oXbQjCKywF1BeFohswF3vZdogbmEF6pZkOsXTzWkrZszrWpQTByYVg==
dependencies:
tslib "^1.9.0"

[email protected], safe-buffer@~5.1.0, safe-buffer@~5.1.1:
version "5.1.2"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
Expand Down

0 comments on commit 20cb5e0

Please sign in to comment.