Skip to content

Commit 73590e5

Browse files
committed
Migrate from yargs to yargs-parser for the CLI
The encore CLI is not implemented using the yargs features, as it is a wrapper around the webpack and webpack-dev-server. Only the parsing from yargs was used. And this is implemented by yargs-parser. Depending on that package directly avoids bring the full (outdated) yargs.
1 parent 801fc91 commit 73590e5

File tree

5 files changed

+13
-31
lines changed

5 files changed

+13
-31
lines changed

bin/encore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const chalk = require('chalk');
1616
const logger = require('../lib/logger');
1717

1818
const runtimeConfig = parseRuntime(
19-
require('yargs/yargs')(process.argv.slice(2)).argv,
19+
require('yargs-parser')(process.argv.slice(2)),
2020
process.cwd()
2121
);
2222
context.runtimeConfig = runtimeConfig;

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ class Encore {
11671167
runtimeConfig = parseRuntime(
11681168
Object.assign(
11691169
{},
1170-
require('yargs/yargs')([environment]).argv,
1170+
require('yargs-parser')([environment]),
11711171
options
11721172
),
11731173
process.cwd()

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"webpack-dev-server": "^3.1.14",
5555
"webpack-manifest-plugin": "^2.0.2",
5656
"webpack-sources": "^1.3.0",
57-
"yargs": "^8.0.1"
57+
"yargs-parser": "^12.0.0"
5858
},
5959
"devDependencies": {
6060
"@babel/core": "^7.0.0",

test/config/parse-runtime.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const fs = require('fs-extra');
1616
const path = require('path');
1717

1818
function createArgv(argv) {
19-
return require('yargs/yargs')(argv).argv;
19+
return require('yargs-parser')(argv);
2020
}
2121

2222
function createTestDirectory() {

yarn.lock

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2599,7 +2599,7 @@ debug@^4.1.0:
25992599
dependencies:
26002600
ms "^2.1.1"
26012601

2602-
decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2:
2602+
decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2, decamelize@^1.2.0:
26032603
version "1.2.0"
26042604
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
26052605
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
@@ -9102,20 +9102,21 @@ yargs-parser@^10.1.0:
91029102
dependencies:
91039103
camelcase "^4.1.0"
91049104

9105+
yargs-parser@^12.0.0:
9106+
version "12.0.0"
9107+
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-12.0.0.tgz#18aa348854747dfe1002d01bd87d65df10d40a84"
9108+
integrity sha512-WQM8GrbF5TKiACr7iE3I2ZBNC7qC9taKPMfjJaMD2LkOJQhIctASxKXdFAOPim/m47kgAQBVIaPlFjnRdkol7w==
9109+
dependencies:
9110+
camelcase "^5.0.0"
9111+
decamelize "^1.2.0"
9112+
91059113
yargs-parser@^5.0.0:
91069114
version "5.0.0"
91079115
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0.tgz#275ecf0d7ffe05c77e64e7c86e4cd94bf0e1228a"
91089116
integrity sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=
91099117
dependencies:
91109118
camelcase "^3.0.0"
91119119

9112-
yargs-parser@^7.0.0:
9113-
version "7.0.0"
9114-
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9"
9115-
integrity sha1-jQrELxbqVd69MyyvTEA4s+P139k=
9116-
dependencies:
9117-
camelcase "^4.1.0"
9118-
91199120
yargs-parser@^9.0.2:
91209121
version "9.0.2"
91219122
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-9.0.2.tgz#9ccf6a43460fe4ed40a9bb68f48d43b8a68cc077"
@@ -9178,25 +9179,6 @@ yargs@^7.0.0:
91789179
y18n "^3.2.1"
91799180
yargs-parser "^5.0.0"
91809181

9181-
yargs@^8.0.1:
9182-
version "8.0.2"
9183-
resolved "https://registry.yarnpkg.com/yargs/-/yargs-8.0.2.tgz#6299a9055b1cefc969ff7e79c1d918dceb22c360"
9184-
integrity sha1-YpmpBVsc78lp/355wdkY3Osiw2A=
9185-
dependencies:
9186-
camelcase "^4.1.0"
9187-
cliui "^3.2.0"
9188-
decamelize "^1.1.1"
9189-
get-caller-file "^1.0.1"
9190-
os-locale "^2.0.0"
9191-
read-pkg-up "^2.0.0"
9192-
require-directory "^2.1.1"
9193-
require-main-filename "^1.0.1"
9194-
set-blocking "^2.0.0"
9195-
string-width "^2.0.0"
9196-
which-module "^2.0.0"
9197-
y18n "^3.2.1"
9198-
yargs-parser "^7.0.0"
9199-
92009182
yargs@~3.10.0:
92019183
version "3.10.0"
92029184
resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1"

0 commit comments

Comments
 (0)