Skip to content

Commit fefa7a4

Browse files
committed
fix(@angular/cli): define option is being included multiple times in the JSON help
This commit addresses an issue where the `define` option was being included multiple times in the JSON help. Closes #30710
1 parent e9ac671 commit fefa7a4

File tree

1 file changed

+5
-3
lines changed
  • packages/angular/cli/src/command-builder/utilities

1 file changed

+5
-3
lines changed

packages/angular/cli/src/command-builder/utilities/json-help.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,25 @@ export function jsonHelpUsage(localYargs: Argv): string {
6464
const descriptions = usageInstance.getDescriptions();
6565
const groups = localYargsInstance.getGroups();
6666
const positional = groups[usageInstance.getPositionalGroupName()] as string[] | undefined;
67-
67+
const seen = new Set<string>();
6868
const hidden = new Set(hiddenOptions);
6969
const normalizeOptions: JsonHelpOption[] = [];
7070
const allAliases = new Set([...Object.values<string[]>(aliases).flat()]);
7171

72+
// Reverted order of https://github.com/yargs/yargs/blob/971e351705f0fbc5566c6ed1dfd707fa65e11c0d/lib/usage.ts#L419-L424
7273
for (const [names, type] of [
74+
[number, 'number'],
7375
[array, 'array'],
7476
[string, 'string'],
7577
[boolean, 'boolean'],
76-
[number, 'number'],
7778
]) {
7879
for (const name of names) {
79-
if (allAliases.has(name) || hidden.has(name)) {
80+
if (allAliases.has(name) || hidden.has(name) || seen.has(name)) {
8081
// Ignore hidden, aliases and already visited option.
8182
continue;
8283
}
8384

85+
seen.add(name);
8486
const positionalIndex = positional?.indexOf(name) ?? -1;
8587
const alias = aliases[name];
8688

0 commit comments

Comments
 (0)