@angular/cli 20.0.4 → 20.1.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/config/schema.json +46 -6
- package/lib/config/workspace-schema.d.ts +4 -3
- package/package.json +15 -15
- package/src/command-builder/command-module.d.ts +1 -0
- package/src/command-builder/command-module.js +1 -5
- package/src/command-builder/command-runner.js +5 -4
- package/src/command-builder/utilities/command.d.ts +1 -2
- package/src/command-builder/utilities/command.js +2 -2
- package/src/command-builder/utilities/json-help.d.ts +2 -1
- package/src/command-builder/utilities/json-help.js +6 -10
- package/src/command-builder/utilities/normalize-options-middleware.d.ts +2 -2
- package/src/command-builder/utilities/normalize-options-middleware.js +16 -48
- package/src/commands/analytics/cli.js +1 -1
- package/src/commands/cache/cli.js +1 -1
- package/src/commands/completion/cli.js +3 -6
- package/src/utilities/version.js +1 -1
package/lib/config/schema.json
CHANGED
|
@@ -1118,7 +1118,7 @@
|
|
|
1118
1118
|
},
|
|
1119
1119
|
"name": {
|
|
1120
1120
|
"type": "string",
|
|
1121
|
-
"description": "The name for the new component. This will be used to create the component's class, template, and stylesheet files. For example, if you provide `my-component`, the files will be named `my-component.ts`, `my-component.html`, and `my-component.css`.",
|
|
1121
|
+
"description": "The name for the new component. This will be used to create the component's class, template, and stylesheet files. For example, if you provide `my-component`, the files will be named `my-component.component.ts`, `my-component.component.html`, and `my-component.component.css`.",
|
|
1122
1122
|
"$default": {
|
|
1123
1123
|
"$source": "argv",
|
|
1124
1124
|
"index": 0
|
|
@@ -1131,13 +1131,13 @@
|
|
|
1131
1131
|
"alias": "b"
|
|
1132
1132
|
},
|
|
1133
1133
|
"inlineStyle": {
|
|
1134
|
-
"description": "Include the component's styles directly in the `component.ts` file. By default, a separate stylesheet file (e.g., `my-component.css`) is created.",
|
|
1134
|
+
"description": "Include the component's styles directly in the `component.ts` file. By default, a separate stylesheet file (e.g., `my-component.component.css`) is created.",
|
|
1135
1135
|
"type": "boolean",
|
|
1136
1136
|
"default": false,
|
|
1137
1137
|
"alias": "s"
|
|
1138
1138
|
},
|
|
1139
1139
|
"inlineTemplate": {
|
|
1140
|
-
"description": "Include the component's HTML template directly in the `component.ts` file. By default, a separate template file (e.g., `my-component.html`) is created.",
|
|
1140
|
+
"description": "Include the component's HTML template directly in the `component.ts` file. By default, a separate template file (e.g., `my-component.component.html`) is created.",
|
|
1141
1141
|
"type": "boolean",
|
|
1142
1142
|
"default": false,
|
|
1143
1143
|
"alias": "t"
|
|
@@ -2240,7 +2240,7 @@
|
|
|
2240
2240
|
]
|
|
2241
2241
|
},
|
|
2242
2242
|
"loader": {
|
|
2243
|
-
"description": "Defines the type of loader to use with a specified file extension when used with a JavaScript `import`. `text` inlines the content as a string; `binary` inlines the content as a Uint8Array; `file` emits the file and provides the runtime location of the file; `empty` considers the content to be empty and not include it in bundles.",
|
|
2243
|
+
"description": "Defines the type of loader to use with a specified file extension when used with a JavaScript `import`. `text` inlines the content as a string; `binary` inlines the content as a Uint8Array; `file` emits the file and provides the runtime location of the file; `dataurl` inlines the content as a data URL with best guess of MIME type; `base64` inlines the content as a Base64-encoded string; `empty` considers the content to be empty and not include it in bundles.",
|
|
2244
2244
|
"type": "object",
|
|
2245
2245
|
"patternProperties": {
|
|
2246
2246
|
"^\\.\\S+$": {
|
|
@@ -2248,6 +2248,8 @@
|
|
|
2248
2248
|
"text",
|
|
2249
2249
|
"binary",
|
|
2250
2250
|
"file",
|
|
2251
|
+
"dataurl",
|
|
2252
|
+
"base64",
|
|
2251
2253
|
"empty"
|
|
2252
2254
|
]
|
|
2253
2255
|
}
|
|
@@ -4317,6 +4319,30 @@
|
|
|
4317
4319
|
},
|
|
4318
4320
|
"default": []
|
|
4319
4321
|
},
|
|
4322
|
+
"codeCoverageReporters": {
|
|
4323
|
+
"type": "array",
|
|
4324
|
+
"description": "Reporters to use for code coverage results.",
|
|
4325
|
+
"items": {
|
|
4326
|
+
"oneOf": [
|
|
4327
|
+
{
|
|
4328
|
+
"$ref": "#/definitions/AngularBuildBuildersUnitTestSchema/definitions/coverage-reporters"
|
|
4329
|
+
},
|
|
4330
|
+
{
|
|
4331
|
+
"type": "array",
|
|
4332
|
+
"minItems": 1,
|
|
4333
|
+
"maxItems": 2,
|
|
4334
|
+
"items": [
|
|
4335
|
+
{
|
|
4336
|
+
"$ref": "#/definitions/AngularBuildBuildersUnitTestSchema/definitions/coverage-reporters"
|
|
4337
|
+
},
|
|
4338
|
+
{
|
|
4339
|
+
"type": "object"
|
|
4340
|
+
}
|
|
4341
|
+
]
|
|
4342
|
+
}
|
|
4343
|
+
]
|
|
4344
|
+
}
|
|
4345
|
+
},
|
|
4320
4346
|
"reporters": {
|
|
4321
4347
|
"type": "array",
|
|
4322
4348
|
"description": "Test runner reporters to use. Directly passed to the test runner.",
|
|
@@ -4330,7 +4356,19 @@
|
|
|
4330
4356
|
"minLength": 1
|
|
4331
4357
|
}
|
|
4332
4358
|
},
|
|
4333
|
-
"additionalProperties": false
|
|
4359
|
+
"additionalProperties": false,
|
|
4360
|
+
"definitions": {
|
|
4361
|
+
"coverage-reporters": {
|
|
4362
|
+
"enum": [
|
|
4363
|
+
"html",
|
|
4364
|
+
"lcov",
|
|
4365
|
+
"lcovonly",
|
|
4366
|
+
"text",
|
|
4367
|
+
"text-summary",
|
|
4368
|
+
"cobertura"
|
|
4369
|
+
]
|
|
4370
|
+
}
|
|
4371
|
+
}
|
|
4334
4372
|
},
|
|
4335
4373
|
"AngularBuildBuildersKarmaSchema": {
|
|
4336
4374
|
"title": "Karma Target",
|
|
@@ -4499,7 +4537,7 @@
|
|
|
4499
4537
|
"default": []
|
|
4500
4538
|
},
|
|
4501
4539
|
"loader": {
|
|
4502
|
-
"description": "Defines the type of loader to use with a specified file extension when used with a JavaScript `import`. `text` inlines the content as a string; `binary` inlines the content as a Uint8Array; `file` emits the file and provides the runtime location of the file; `empty` considers the content to be empty and not include it in bundles.",
|
|
4540
|
+
"description": "Defines the type of loader to use with a specified file extension when used with a JavaScript `import`. `text` inlines the content as a string; `binary` inlines the content as a Uint8Array; `file` emits the file and provides the runtime location of the file; `dataurl` inlines the content as a data URL with best guess of MIME type; `base64` inlines the content as a Base64-encoded string; `empty` considers the content to be empty and not include it in bundles.",
|
|
4503
4541
|
"type": "object",
|
|
4504
4542
|
"patternProperties": {
|
|
4505
4543
|
"^\\.\\S+$": {
|
|
@@ -4507,6 +4545,8 @@
|
|
|
4507
4545
|
"text",
|
|
4508
4546
|
"binary",
|
|
4509
4547
|
"file",
|
|
4548
|
+
"dataurl",
|
|
4549
|
+
"base64",
|
|
4510
4550
|
"empty"
|
|
4511
4551
|
]
|
|
4512
4552
|
}
|
|
@@ -278,12 +278,12 @@ export type AngularComponentOptionsSchema = {
|
|
|
278
278
|
flat?: boolean;
|
|
279
279
|
/**
|
|
280
280
|
* Include the component's styles directly in the `component.ts` file. By default, a
|
|
281
|
-
* separate stylesheet file (e.g., `my-component.css`) is created.
|
|
281
|
+
* separate stylesheet file (e.g., `my-component.component.css`) is created.
|
|
282
282
|
*/
|
|
283
283
|
inlineStyle?: boolean;
|
|
284
284
|
/**
|
|
285
285
|
* Include the component's HTML template directly in the `component.ts` file. By default, a
|
|
286
|
-
* separate template file (e.g., `my-component.html`) is created.
|
|
286
|
+
* separate template file (e.g., `my-component.component.html`) is created.
|
|
287
287
|
*/
|
|
288
288
|
inlineTemplate?: boolean;
|
|
289
289
|
/**
|
|
@@ -294,7 +294,8 @@ export type AngularComponentOptionsSchema = {
|
|
|
294
294
|
/**
|
|
295
295
|
* The name for the new component. This will be used to create the component's class,
|
|
296
296
|
* template, and stylesheet files. For example, if you provide `my-component`, the files
|
|
297
|
-
* will be named `my-component.ts`, `my-component.html`, and
|
|
297
|
+
* will be named `my-component.component.ts`, `my-component.component.html`, and
|
|
298
|
+
* `my-component.component.css`.
|
|
298
299
|
*/
|
|
299
300
|
name: string;
|
|
300
301
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/cli",
|
|
3
|
-
"version": "20.0.
|
|
3
|
+
"version": "20.1.0-next.1",
|
|
4
4
|
"description": "CLI tool for Angular",
|
|
5
5
|
"main": "lib/cli/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/angular/angular-cli",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@angular-devkit/architect": "0.
|
|
29
|
-
"@angular-devkit/core": "20.0.
|
|
30
|
-
"@angular-devkit/schematics": "20.0.
|
|
31
|
-
"@inquirer/prompts": "7.5.
|
|
28
|
+
"@angular-devkit/architect": "0.2001.0-next.1",
|
|
29
|
+
"@angular-devkit/core": "20.1.0-next.1",
|
|
30
|
+
"@angular-devkit/schematics": "20.1.0-next.1",
|
|
31
|
+
"@inquirer/prompts": "7.5.3",
|
|
32
32
|
"@listr2/prompt-adapter-inquirer": "2.0.22",
|
|
33
|
-
"@schematics/angular": "20.0.
|
|
33
|
+
"@schematics/angular": "20.1.0-next.1",
|
|
34
34
|
"@yarnpkg/lockfile": "1.1.0",
|
|
35
35
|
"ini": "5.0.0",
|
|
36
36
|
"jsonc-parser": "3.3.1",
|
|
@@ -40,19 +40,19 @@
|
|
|
40
40
|
"pacote": "21.0.0",
|
|
41
41
|
"resolve": "1.22.10",
|
|
42
42
|
"semver": "7.7.2",
|
|
43
|
-
"yargs": "
|
|
43
|
+
"yargs": "18.0.0"
|
|
44
44
|
},
|
|
45
45
|
"ng-update": {
|
|
46
46
|
"migrations": "@schematics/angular/migrations/migration-collection.json",
|
|
47
47
|
"packageGroup": {
|
|
48
|
-
"@angular/cli": "20.0.
|
|
49
|
-
"@angular/build": "20.0.
|
|
50
|
-
"@angular/ssr": "20.0.
|
|
51
|
-
"@angular-devkit/architect": "0.
|
|
52
|
-
"@angular-devkit/build-angular": "20.0.
|
|
53
|
-
"@angular-devkit/build-webpack": "0.
|
|
54
|
-
"@angular-devkit/core": "20.0.
|
|
55
|
-
"@angular-devkit/schematics": "20.0.
|
|
48
|
+
"@angular/cli": "20.1.0-next.1",
|
|
49
|
+
"@angular/build": "20.1.0-next.1",
|
|
50
|
+
"@angular/ssr": "20.1.0-next.1",
|
|
51
|
+
"@angular-devkit/architect": "0.2001.0-next.1",
|
|
52
|
+
"@angular-devkit/build-angular": "20.1.0-next.1",
|
|
53
|
+
"@angular-devkit/build-webpack": "0.2001.0-next.1",
|
|
54
|
+
"@angular-devkit/core": "20.1.0-next.1",
|
|
55
|
+
"@angular-devkit/schematics": "20.1.0-next.1"
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"packageManager": "pnpm@9.15.9",
|
|
@@ -30,6 +30,7 @@ export interface CommandContext {
|
|
|
30
30
|
globalConfiguration: AngularWorkspace;
|
|
31
31
|
logger: logging.Logger;
|
|
32
32
|
packageManager: PackageManagerUtils;
|
|
33
|
+
yargsInstance: Argv<{}>;
|
|
33
34
|
/** Arguments parsed in free-from without parser configuration. */
|
|
34
35
|
args: {
|
|
35
36
|
positional: string[];
|
|
@@ -73,15 +73,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
73
73
|
return result;
|
|
74
74
|
};
|
|
75
75
|
})();
|
|
76
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
77
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
78
|
-
};
|
|
79
76
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
80
77
|
exports.CommandModuleError = exports.CommandModule = exports.CommandScope = void 0;
|
|
81
78
|
const core_1 = require("@angular-devkit/core");
|
|
82
79
|
const node_fs_1 = require("node:fs");
|
|
83
80
|
const path = __importStar(require("node:path"));
|
|
84
|
-
const yargs_1 = __importDefault(require("yargs"));
|
|
85
81
|
const helpers_1 = require("yargs/helpers");
|
|
86
82
|
const analytics_1 = require("../analytics/analytics");
|
|
87
83
|
const analytics_collector_1 = require("../analytics/analytics-collector");
|
|
@@ -232,7 +228,7 @@ let CommandModule = (() => {
|
|
|
232
228
|
}
|
|
233
229
|
reportCommandRunAnalytics(analytics) {
|
|
234
230
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
235
|
-
const internalMethods =
|
|
231
|
+
const internalMethods = this.context.yargsInstance.getInternalMethods();
|
|
236
232
|
// $0 generate component [name] -> generate_component
|
|
237
233
|
// $0 add <collection> -> add
|
|
238
234
|
const fullCommand = internalMethods.getUsageInstance().getUsage()[0][0]
|
|
@@ -45,11 +45,13 @@ async function runCommand(args, logger) {
|
|
|
45
45
|
return 1;
|
|
46
46
|
}
|
|
47
47
|
const root = workspace?.basePath ?? process.cwd();
|
|
48
|
+
const localYargs = (0, yargs_1.default)(args);
|
|
48
49
|
const context = {
|
|
49
50
|
globalConfiguration,
|
|
50
51
|
workspace,
|
|
51
52
|
logger,
|
|
52
53
|
currentDirectory: process.cwd(),
|
|
54
|
+
yargsInstance: localYargs,
|
|
53
55
|
root,
|
|
54
56
|
packageManager: new package_manager_1.PackageManagerUtils({ globalConfiguration, workspace, root }),
|
|
55
57
|
args: {
|
|
@@ -62,14 +64,13 @@ async function runCommand(args, logger) {
|
|
|
62
64
|
},
|
|
63
65
|
},
|
|
64
66
|
};
|
|
65
|
-
let localYargs = (0, yargs_1.default)(args);
|
|
66
67
|
for (const CommandModule of await getCommandsToRegister(positional[0])) {
|
|
67
|
-
|
|
68
|
+
(0, command_1.addCommandModuleToYargs)(CommandModule, context);
|
|
68
69
|
}
|
|
69
70
|
if (jsonHelp) {
|
|
70
71
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
71
72
|
const usageInstance = localYargs.getInternalMethods().getUsageInstance();
|
|
72
|
-
usageInstance.help = () => (0, json_help_1.jsonHelpUsage)();
|
|
73
|
+
usageInstance.help = () => (0, json_help_1.jsonHelpUsage)(localYargs);
|
|
73
74
|
}
|
|
74
75
|
// Add default command to support version option when no subcommand is specified
|
|
75
76
|
localYargs.command('*', false, (builder) => builder.version('version', 'Show Angular CLI version.', version_1.VERSION.full));
|
|
@@ -104,7 +105,7 @@ async function runCommand(args, logger) {
|
|
|
104
105
|
.epilogue('For more information, see https://angular.dev/cli/.\n')
|
|
105
106
|
.demandCommand(1, command_1.demandCommandFailureMessage)
|
|
106
107
|
.recommendCommands()
|
|
107
|
-
.middleware(normalize_options_middleware_1.
|
|
108
|
+
.middleware((0, normalize_options_middleware_1.createNormalizeOptionsMiddleware)(localYargs))
|
|
108
109
|
.version(false)
|
|
109
110
|
.showHelpOnFail(false)
|
|
110
111
|
.strict()
|
|
@@ -5,10 +5,9 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
-
import { Argv } from 'yargs';
|
|
9
8
|
import { CommandContext, CommandModule, CommandModuleImplementation } from '../command-module';
|
|
10
9
|
export declare const demandCommandFailureMessage = "You need to specify a command before moving on. Use '--help' to view the available commands.";
|
|
11
10
|
export type CommandModuleConstructor = Partial<CommandModuleImplementation> & {
|
|
12
11
|
new (context: CommandContext): Partial<CommandModuleImplementation> & CommandModule;
|
|
13
12
|
};
|
|
14
|
-
export declare function addCommandModuleToYargs<
|
|
13
|
+
export declare function addCommandModuleToYargs<U extends CommandModuleConstructor>(commandModule: U, context: CommandContext): void;
|
|
@@ -11,11 +11,11 @@ exports.demandCommandFailureMessage = void 0;
|
|
|
11
11
|
exports.addCommandModuleToYargs = addCommandModuleToYargs;
|
|
12
12
|
const command_module_1 = require("../command-module");
|
|
13
13
|
exports.demandCommandFailureMessage = `You need to specify a command before moving on. Use '--help' to view the available commands.`;
|
|
14
|
-
function addCommandModuleToYargs(
|
|
14
|
+
function addCommandModuleToYargs(commandModule, context) {
|
|
15
15
|
const cmd = new commandModule(context);
|
|
16
16
|
const { args: { options: { jsonHelp }, }, workspace, } = context;
|
|
17
17
|
const describe = jsonHelp ? cmd.fullDescribe : cmd.describe;
|
|
18
|
-
|
|
18
|
+
context.yargsInstance.command({
|
|
19
19
|
command: cmd.command,
|
|
20
20
|
aliases: cmd.aliases,
|
|
21
21
|
describe:
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
+
import { Argv } from 'yargs';
|
|
8
9
|
interface JsonHelpOption {
|
|
9
10
|
name: string;
|
|
10
11
|
type?: string;
|
|
@@ -32,5 +33,5 @@ export interface JsonHelp extends JsonHelpDescription {
|
|
|
32
33
|
options: JsonHelpOption[];
|
|
33
34
|
subcommands?: JsonHelpSubcommand[];
|
|
34
35
|
}
|
|
35
|
-
export declare function jsonHelpUsage(): string;
|
|
36
|
+
export declare function jsonHelpUsage(localYargs: Argv): string;
|
|
36
37
|
export {};
|
|
@@ -6,22 +6,18 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
-
};
|
|
12
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
10
|
exports.jsonHelpUsage = jsonHelpUsage;
|
|
14
|
-
const yargs_1 = __importDefault(require("yargs"));
|
|
15
11
|
const yargsDefaultCommandRegExp = /^\$0|\*/;
|
|
16
|
-
function jsonHelpUsage() {
|
|
12
|
+
function jsonHelpUsage(localYargs) {
|
|
17
13
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
-
const
|
|
19
|
-
const { deprecatedOptions, alias: aliases, array, string, boolean, number, choices, demandedOptions, default: defaultVal, hiddenOptions = [], } =
|
|
20
|
-
const internalMethods =
|
|
14
|
+
const localYargsInstance = localYargs;
|
|
15
|
+
const { deprecatedOptions, alias: aliases, array, string, boolean, number, choices, demandedOptions, default: defaultVal, hiddenOptions = [], } = localYargsInstance.getOptions();
|
|
16
|
+
const internalMethods = localYargsInstance.getInternalMethods();
|
|
21
17
|
const usageInstance = internalMethods.getUsageInstance();
|
|
22
18
|
const context = internalMethods.getContext();
|
|
23
19
|
const descriptions = usageInstance.getDescriptions();
|
|
24
|
-
const groups =
|
|
20
|
+
const groups = localYargsInstance.getGroups();
|
|
25
21
|
const positional = groups[usageInstance.getPositionalGroupName()];
|
|
26
22
|
const hidden = new Set(hiddenOptions);
|
|
27
23
|
const normalizeOptions = [];
|
|
@@ -68,7 +64,7 @@ function jsonHelpUsage() {
|
|
|
68
64
|
const otherSubcommands = subcommands.filter((s) => !s.default);
|
|
69
65
|
const output = {
|
|
70
66
|
name: [...context.commands].pop(),
|
|
71
|
-
command: `${command?.replace(yargsDefaultCommandRegExp,
|
|
67
|
+
command: `${command?.replace(yargsDefaultCommandRegExp, localYargsInstance['$0'])}${defaultSubCommand}`,
|
|
72
68
|
...parseDescription(rawDescription),
|
|
73
69
|
options: normalizeOptions.sort((a, b) => a.name.localeCompare(b.name)),
|
|
74
70
|
subcommands: otherSubcommands.length ? otherSubcommands : undefined,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import type { Arguments, Argv } from 'yargs';
|
|
9
9
|
/**
|
|
10
10
|
* A Yargs middleware that normalizes non Array options when the argument has been provided multiple times.
|
|
11
11
|
*
|
|
@@ -15,4 +15,4 @@ import * as yargs from 'yargs';
|
|
|
15
15
|
*
|
|
16
16
|
* See: https://github.com/yargs/yargs-parser/pull/163#issuecomment-516566614
|
|
17
17
|
*/
|
|
18
|
-
export declare function
|
|
18
|
+
export declare function createNormalizeOptionsMiddleware(localeYargs: Argv): (args: Arguments) => void;
|
|
@@ -6,42 +6,8 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
-
var ownKeys = function(o) {
|
|
27
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
-
var ar = [];
|
|
29
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
-
return ar;
|
|
31
|
-
};
|
|
32
|
-
return ownKeys(o);
|
|
33
|
-
};
|
|
34
|
-
return function (mod) {
|
|
35
|
-
if (mod && mod.__esModule) return mod;
|
|
36
|
-
var result = {};
|
|
37
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
-
__setModuleDefault(result, mod);
|
|
39
|
-
return result;
|
|
40
|
-
};
|
|
41
|
-
})();
|
|
42
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.
|
|
44
|
-
const yargs = __importStar(require("yargs"));
|
|
10
|
+
exports.createNormalizeOptionsMiddleware = createNormalizeOptionsMiddleware;
|
|
45
11
|
/**
|
|
46
12
|
* A Yargs middleware that normalizes non Array options when the argument has been provided multiple times.
|
|
47
13
|
*
|
|
@@ -51,18 +17,20 @@ const yargs = __importStar(require("yargs"));
|
|
|
51
17
|
*
|
|
52
18
|
* See: https://github.com/yargs/yargs-parser/pull/163#issuecomment-516566614
|
|
53
19
|
*/
|
|
54
|
-
function
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
20
|
+
function createNormalizeOptionsMiddleware(localeYargs) {
|
|
21
|
+
return (args) => {
|
|
22
|
+
// `getOptions` is not included in the types even though it's public API.
|
|
23
|
+
// https://github.com/yargs/yargs/issues/2098
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
+
const { array } = localeYargs.getOptions();
|
|
26
|
+
const arrayOptions = new Set(array);
|
|
27
|
+
for (const [key, value] of Object.entries(args)) {
|
|
28
|
+
if (key !== '_' && Array.isArray(value) && !arrayOptions.has(key)) {
|
|
29
|
+
const newValue = value.pop();
|
|
30
|
+
// eslint-disable-next-line no-console
|
|
31
|
+
console.warn(`Option '${key}' has been specified multiple times. The value '${newValue}' will be used.`);
|
|
32
|
+
args[key] = newValue;
|
|
33
|
+
}
|
|
66
34
|
}
|
|
67
|
-
}
|
|
35
|
+
};
|
|
68
36
|
}
|
|
@@ -24,7 +24,7 @@ class AnalyticsCommandModule extends command_module_1.CommandModule {
|
|
|
24
24
|
cli_2.AnalyticsPromptModule,
|
|
25
25
|
].sort(); // sort by class name.
|
|
26
26
|
for (const module of subcommands) {
|
|
27
|
-
|
|
27
|
+
(0, command_1.addCommandModuleToYargs)(module, this.context);
|
|
28
28
|
}
|
|
29
29
|
return localYargs.demandCommand(1, command_1.demandCommandFailureMessage).strict();
|
|
30
30
|
}
|
|
@@ -26,7 +26,7 @@ class CacheCommandModule extends command_module_1.CommandModule {
|
|
|
26
26
|
cli_2.CacheInfoCommandModule,
|
|
27
27
|
].sort();
|
|
28
28
|
for (const module of subcommands) {
|
|
29
|
-
|
|
29
|
+
(0, command_1.addCommandModuleToYargs)(module, this.context);
|
|
30
30
|
}
|
|
31
31
|
return localYargs.demandCommand(1, command_1.demandCommandFailureMessage).strict();
|
|
32
32
|
}
|
|
@@ -6,12 +6,8 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
-
};
|
|
12
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
10
|
const node_path_1 = require("node:path");
|
|
14
|
-
const yargs_1 = __importDefault(require("yargs"));
|
|
15
11
|
const command_module_1 = require("../../command-builder/command-module");
|
|
16
12
|
const command_1 = require("../../command-builder/utilities/command");
|
|
17
13
|
const color_1 = require("../../utilities/color");
|
|
@@ -22,7 +18,8 @@ class CompletionCommandModule extends command_module_1.CommandModule {
|
|
|
22
18
|
describe = 'Set up Angular CLI autocompletion for your terminal.';
|
|
23
19
|
longDescriptionPath = (0, node_path_1.join)(__dirname, 'long-description.md');
|
|
24
20
|
builder(localYargs) {
|
|
25
|
-
|
|
21
|
+
(0, command_1.addCommandModuleToYargs)(CompletionScriptCommandModule, this.context);
|
|
22
|
+
return localYargs;
|
|
26
23
|
}
|
|
27
24
|
async run() {
|
|
28
25
|
let rcFile;
|
|
@@ -58,6 +55,6 @@ class CompletionScriptCommandModule extends command_module_1.CommandModule {
|
|
|
58
55
|
return localYargs;
|
|
59
56
|
}
|
|
60
57
|
run() {
|
|
61
|
-
|
|
58
|
+
this.context.yargsInstance.showCompletionScript();
|
|
62
59
|
}
|
|
63
60
|
}
|
package/src/utilities/version.js
CHANGED