refactor: update yargs to new API for ESM compatibility (#43431)

Given that we ship all of compiler-cli and localize in ESM
mode now, we need to use a ESM compatible version of Yargs.
The latest version seems ESM compatible but with some small
API changes. This commit updates Yargs and updates the command
line option code to use the new API.

PR Close #43431
This commit is contained in:
Paul Gschwendtner
2021-09-26 12:29:54 +02:00
committed by Dylan Hunn
parent d442764470
commit cebcfbe1d9
8 changed files with 17 additions and 17 deletions
+2 -2
View File
@@ -97,7 +97,7 @@
"@types/shelljs": "^0.8.6",
"@types/systemjs": "0.19.32",
"@types/uuid": "^8.3.1",
"@types/yargs": "^16.0.1",
"@types/yargs": "^17.0.3",
"@webcomponents/custom-elements": "^1.1.0",
"angular-1.5": "npm:angular@1.5",
"angular-1.6": "npm:angular@1.6",
@@ -161,7 +161,7 @@
"tslint": "6.1.3",
"typescript": "~4.4.2",
"xhr2": "0.2.1",
"yargs": "^17.0.0"
"yargs": "^17.2.1"
},
"// 2": "devDependencies are not used under Bazel. Many can be removed after test.sh is deleted.",
"devDependencies": {
@@ -14,7 +14,7 @@ import {NgccOptions} from './ngcc_options';
export function parseCommandLineOptions(args: string[]): NgccOptions {
const options =
yargs
yargs(args)
.option('s', {
alias: 'source',
describe:
@@ -114,7 +114,7 @@ export function parseCommandLineOptions(args: string[]): NgccOptions {
})
.strict()
.help()
.parse(args);
.parseSync();
if (options.f?.length) {
console.error(
+1 -1
View File
@@ -61,7 +61,7 @@
"source-map": "^0.6.1",
"sourcemap-codec": "^1.4.8",
"tslib": "^2.3.0",
"yargs": "^17.0.0"
"yargs": "^17.2.1"
},
"peerDependencies": {
"@angular/compiler": "0.0.0-PLACEHOLDER",
+1 -1
View File
@@ -36,7 +36,7 @@
"dependencies": {
"@babel/core": "7.8.6",
"glob": "7.2.0",
"yargs": "^17.0.0"
"yargs": "^17.2.1"
},
"peerDependencies": {
"@angular/compiler": "0.0.0-PLACEHOLDER",
+2 -2
View File
@@ -18,7 +18,7 @@ import {extractTranslations} from './index';
process.title = 'Angular Localization Message Extractor (localize-extract)';
const args = process.argv.slice(2);
const options =
yargs
yargs(args)
.option('l', {
alias: 'locale',
describe: 'The locale of the source being processed',
@@ -88,7 +88,7 @@ const options =
})
.strict()
.help()
.parse(args);
.parseSync();
const fileSystem = new NodeJSFileSystem();
setFileSystem(fileSystem);
+2 -2
View File
@@ -14,7 +14,7 @@ import {migrateFiles} from './index';
const args = process.argv.slice(2);
const options =
yargs
yargs(args)
.option('r', {
alias: 'root',
default: '.',
@@ -38,7 +38,7 @@ const options =
})
.strict()
.help()
.parse(args);
.parseSync();
const fs = new NodeJSFileSystem();
setFileSystem(fs);
+2 -2
View File
@@ -17,7 +17,7 @@ import {translateFiles} from './index';
process.title = 'Angular Localization Message Translator (localize-translate)';
const args = process.argv.slice(2);
const options =
yargs
yargs(args)
.option('r', {
alias: 'root',
required: true,
@@ -88,7 +88,7 @@ const options =
.strict()
.help()
.parse(args);
.parseSync();
const fs = new NodeJSFileSystem();
setFileSystem(fs);
+5 -5
View File
@@ -2331,10 +2331,10 @@
resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-20.2.1.tgz#3b9ce2489919d9e4fea439b76916abc34b2df129"
integrity sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==
"@types/yargs@^16.0.1":
version "16.0.4"
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-16.0.4.tgz#26aad98dd2c2a38e421086ea9ad42b9e51642977"
integrity sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==
"@types/yargs@^17.0.3":
version "17.0.3"
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.3.tgz#e6c552aa3277b21a8e802019d03ee5e77894cf27"
integrity sha512-K7rm3Ke3ag/pAniBe80A6J6fjoqRibvCrl3dRmtXV9eCEt9h/pZwmHX9MzjQVUc/elneQTL4Ky7XKorC71Lmxw==
dependencies:
"@types/yargs-parser" "*"
@@ -13948,7 +13948,7 @@ yargs@^16.0.0, yargs@^16.1.1, yargs@^16.2.0:
y18n "^5.0.5"
yargs-parser "^20.2.2"
yargs@^17.0.0:
yargs@^17.0.0, yargs@^17.2.1:
version "17.2.1"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.2.1.tgz#e2c95b9796a0e1f7f3bf4427863b42e0418191ea"
integrity sha512-XfR8du6ua4K6uLGm5S6fA+FIJom/MdJcFNVY8geLlp2v8GYbOXD4EB1tPNZsRn4vBzKGMgb5DRZMeWuFc2GO8Q==