Skip to content

Commit 18773b1

Browse files
matheus1lvasokra
authored andcommitted
Simplifying package manager choice and command options
1 parent 73d36c0 commit 18773b1

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

‎bin/webpack.js‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,11 @@ if (!webpackCliInstalled) {
3434
const inquirer = require("inquirer");
3535
const isYarn = fs.existsSync(path.resolve(process.cwd(), "yarn.lock"));
3636

37-
let packageManager;
38-
let options = [];
37+
const packageManager = isYarn ? "yarn" : "npm";
38+
const options = ["install", "-D", "webpack-cli"];
39+
3940
if (isYarn) {
40-
packageManager = "yarn";
41-
options = ["add", "-D", "webpack-cli"];
42-
} else {
43-
packageManager = "npm";
44-
options = ["install", "--save-dev", "webpack-cli"];
41+
options[0] = "add";
4542
}
4643

4744
const commandToBeRun = `${packageManager} ${options.join(" ")}`;

0 commit comments

Comments
 (0)