Skip to content

Commit

Permalink
refactor: remove webpack-command from CLIs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Sep 4, 2018
1 parent 76c3193 commit 898462d
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions bin/webpack.js
Expand Up @@ -103,9 +103,7 @@ if (installedClis.length === 0) {
)}".`
);

let question = `Which one do you like to install (${CLIs.map(
item => item.name
).join("/")}):\n`;
let question = `Do you want to install 'webpack-cli' (yes/no): `;

const questionInterface = readLine.createInterface({
input: process.stdin,
Expand All @@ -114,35 +112,22 @@ if (installedClis.length === 0) {
questionInterface.question(question, answer => {
questionInterface.close();

const normalizedAnswer = answer.toLowerCase();
const selectedPackage = CLIs.find(item => {
return item.name === normalizedAnswer || item.alias === normalizedAnswer;
});
const normalizedAnswer = answer.toLowerCase().startsWith("y");

if (!normalizedAnswer) {
console.error(
"One CLI needs to be installed alongside webpack to use the CLI."
);
process.exitCode = 1;

return;
} else if (!selectedPackage) {
console.error(
"No matching choice.\n" +
"One CLI needs to be installed alongside webpack to use the CLI.\n" +
"Try to installing your CLI of choice manually."
"You need to install 'webpack-cli' for using webpack via CLI.\n" +
"Also you can installing CLI manually."
);
process.exitCode = 1;

return;
}

const packageName = selectedPackage.package;
const packageName = "webpack-cli";

console.log(
`Installing '${
selectedPackage.name
}' (running '${packageManager} ${installOptions.join(
`Installing '${packageName}' (running '${packageManager} ${installOptions.join(
" "
)} ${packageName}')...`
);
Expand Down

0 comments on commit 898462d

Please sign in to comment.