Skip to content

Commit

Permalink
build: update @types/yargs-parser to 21.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-agius4 committed Mar 3, 2022
1 parent 3d0204d commit ac98f25
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"@types/semver": "^7.0.0",
"@types/text-table": "^0.2.1",
"@types/uuid": "^8.0.0",
"@types/yargs-parser": "^20.2.1",
"@types/yargs-parser": "^21.0.0",
"@typescript-eslint/eslint-plugin": "5.13.0",
"@typescript-eslint/parser": "5.13.0",
"@yarnpkg/lockfile": "1.1.0",
Expand Down
11 changes: 2 additions & 9 deletions packages/angular_devkit/architect_cli/bin/architect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import * as ansiColors from 'ansi-colors';
import { existsSync } from 'fs';
import * as path from 'path';
import { tap } from 'rxjs/operators';
import yargsParser from 'yargs-parser';
import yargsParser, { camelCase, decamelize } from 'yargs-parser';
import { MultiProgressBar } from '../src/progress';

function findUp(names: string | string[], from: string) {
Expand Down Expand Up @@ -90,21 +90,14 @@ async function _executeTarget(
help,
...options
} = argv;
const [project, target, configuration] = targetStr.split(':');
const [project, target, configuration] = targetStr.toString().split(':');
const targetSpec = { project, target, configuration };

const logger = new logging.Logger('jobs');
const logs: logging.LogEntry[] = [];
logger.subscribe((entry) => logs.push({ ...entry, message: `${entry.name}: ` + entry.message }));

// Camelize options as yargs will return the object in kebab-case when camel casing is disabled.

// Casting temporary until https://github.com/DefinitelyTyped/DefinitelyTyped/pull/59065 is merged and released.
const { camelCase, decamelize } = yargsParser as yargsParser.Parser & {
camelCase(str: string): string;
decamelize(str: string, joinString?: string): string;
};

const camelCasedOptions: json.JsonObject = {};
for (const [key, value] of Object.entries(options)) {
if (/[A-Z]/.test(key)) {
Expand Down
10 changes: 2 additions & 8 deletions packages/angular_devkit/schematics_cli/bin/schematics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { UnsuccessfulWorkflowExecution } from '@angular-devkit/schematics';
import { NodeWorkflow } from '@angular-devkit/schematics/tools';
import * as ansiColors from 'ansi-colors';
import * as inquirer from 'inquirer';
import yargsParser from 'yargs-parser';
import yargsParser, { camelCase, decamelize } from 'yargs-parser';

/**
* Parse the name of schematic passed in argument, and return a {collection, schematic} named
Expand Down Expand Up @@ -378,12 +378,6 @@ function parseArgs(args: string[]): Options {
): key is ElementType<typeof booleanArgs> =>
booleanArgs.includes(key as ElementType<typeof booleanArgs>);

// Casting temporary until https://github.com/DefinitelyTyped/DefinitelyTyped/pull/59065 is merged and released.
const { camelCase, decamelize } = yargsParser as yargsParser.Parser & {
camelCase(str: string): string;
decamelize(str: string, joinString?: string): string;
};

for (const [key, value] of Object.entries(options)) {
if (/[A-Z]/.test(key)) {
throw new Error(`Unknown argument ${key}. Did you mean ${decamelize(key)}?`);
Expand All @@ -397,7 +391,7 @@ function parseArgs(args: string[]): Options {
}

return {
_,
_: _.map((v) => v.toString()),
schematicOptions,
cliOptions,
};
Expand Down
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2217,11 +2217,16 @@
dependencies:
"@types/node" "*"

"@types/yargs-parser@*", "@types/yargs-parser@^20.2.1":
"@types/yargs-parser@*":
version "20.2.1"
resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-20.2.1.tgz#3b9ce2489919d9e4fea439b76916abc34b2df129"
integrity sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==

"@types/yargs-parser@^21.0.0":
version "21.0.0"
resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b"
integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==

"@types/yargs@^17.0.0":
version "17.0.8"
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.8.tgz#d23a3476fd3da8a0ea44b5494ca7fa677b9dad4c"
Expand Down Expand Up @@ -10917,7 +10922,7 @@ yaml@^1.10.0, yaml@^1.5.0:
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b"
integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==

yargs-parser@21.0.1:
yargs-parser@21.0.1, yargs-parser@^21.0.0:
version "21.0.1"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.0.1.tgz#0267f286c877a4f0f728fceb6f8a3e4cb95c6e35"
integrity sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg==
Expand All @@ -10935,11 +10940,6 @@ yargs-parser@^20.0.0, yargs-parser@^20.2.2:
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee"
integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==

yargs-parser@^21.0.0:
version "21.0.1"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.0.1.tgz#0267f286c877a4f0f728fceb6f8a3e4cb95c6e35"
integrity sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg==

yargs@17.1.1:
version "17.1.1"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.1.1.tgz#c2a8091564bdb196f7c0a67c1d12e5b85b8067ba"
Expand Down

0 comments on commit ac98f25

Please sign in to comment.