@angular/cli 14.0.0-next.1 → 14.0.0-next.12
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/bin/ng.js +3 -5
- package/lib/cli/index.d.ts +1 -2
- package/lib/cli/index.js +16 -45
- package/lib/config/schema.json +48 -15
- package/lib/config/workspace-schema.d.ts +18 -1
- package/lib/init.js +10 -9
- package/package.json +21 -23
- package/{models → src/analytics}/analytics-collector.d.ts +0 -0
- package/{models → src/analytics}/analytics-collector.js +8 -2
- package/src/analytics/analytics.d.ts +47 -0
- package/src/analytics/analytics.js +306 -0
- package/src/command-builder/architect-base-command-module.d.ts +30 -0
- package/src/command-builder/architect-base-command-module.js +165 -0
- package/src/command-builder/architect-command-module.d.ts +25 -0
- package/src/command-builder/architect-command-module.js +134 -0
- package/src/command-builder/command-module.d.ts +89 -0
- package/src/command-builder/command-module.js +198 -0
- package/{utilities/package-json.js → src/command-builder/command-runner.d.ts} +2 -2
- package/src/command-builder/command-runner.js +168 -0
- package/src/command-builder/schematics-command-module.d.ts +43 -0
- package/src/command-builder/schematics-command-module.js +333 -0
- package/src/command-builder/utilities/command.d.ts +13 -0
- package/src/command-builder/utilities/command.js +27 -0
- package/src/command-builder/utilities/json-help.d.ts +36 -0
- package/src/command-builder/utilities/json-help.js +94 -0
- package/src/command-builder/utilities/json-schema.d.ts +40 -0
- package/{utilities → src/command-builder/utilities}/json-schema.js +20 -121
- package/src/command-builder/utilities/normalize-options-middleware.d.ts +18 -0
- package/src/command-builder/utilities/normalize-options-middleware.js +59 -0
- package/{models → src/command-builder/utilities}/schematic-engine-host.d.ts +2 -2
- package/{models → src/command-builder/utilities}/schematic-engine-host.js +33 -18
- package/src/command-builder/utilities/schematic-workflow.d.ts +14 -0
- package/src/command-builder/utilities/schematic-workflow.js +68 -0
- package/src/commands/add/cli.d.ts +33 -0
- package/{commands/add-impl.js → src/commands/add/cli.js} +108 -80
- package/src/commands/add/long-description.md +7 -0
- package/src/commands/analytics/cli.d.ts +16 -0
- package/src/commands/analytics/cli.js +35 -0
- package/src/commands/analytics/info/cli.d.ts +16 -0
- package/src/commands/analytics/info/cli.js +26 -0
- package/src/commands/analytics/settings/cli.d.ts +35 -0
- package/src/commands/analytics/settings/cli.js +61 -0
- package/src/commands/build/cli.d.ts +16 -0
- package/src/commands/build/cli.js +23 -0
- package/{commands/build-long.md → src/commands/build/long-description.md} +0 -0
- package/src/commands/cache/clean/cli.d.ts +17 -0
- package/src/commands/cache/clean/cli.js +32 -0
- package/src/commands/cache/cli.d.ts +17 -0
- package/src/commands/cache/cli.js +38 -0
- package/src/commands/cache/info/cli.d.ts +20 -0
- package/src/commands/cache/info/cli.js +82 -0
- package/src/commands/cache/long-description.md +53 -0
- package/src/commands/cache/settings/cli.d.ts +27 -0
- package/src/commands/cache/settings/cli.js +42 -0
- package/src/commands/cache/utilities.d.ts +11 -0
- package/src/commands/cache/utilities.js +49 -0
- package/src/commands/completion/cli.d.ts +16 -0
- package/src/commands/completion/cli.js +31 -0
- package/src/commands/completion/long-description.md +1 -0
- package/src/commands/config/cli.d.ts +24 -0
- package/{commands/config-impl.js → src/commands/config/cli.js} +102 -89
- package/{commands/config-long.md → src/commands/config/long-description.md} +2 -2
- package/src/commands/deploy/cli.d.ts +17 -0
- package/src/commands/deploy/cli.js +49 -0
- package/{commands/deploy-long.md → src/commands/deploy/long-description.md} +0 -0
- package/src/commands/doc/cli.d.ts +23 -0
- package/{commands/doc-impl.js → src/commands/doc/cli.js} +41 -12
- package/src/commands/e2e/cli.d.ts +18 -0
- package/src/commands/e2e/cli.js +35 -0
- package/src/commands/extract-i18n/cli.d.ts +15 -0
- package/src/commands/extract-i18n/cli.js +20 -0
- package/src/commands/generate/cli.d.ts +39 -0
- package/src/commands/generate/cli.js +145 -0
- package/src/commands/lint/cli.d.ts +17 -0
- package/src/commands/lint/cli.js +28 -0
- package/{commands/lint-long.md → src/commands/lint/long-description.md} +0 -0
- package/src/commands/make-this-awesome/cli.d.ts +17 -0
- package/{commands/easter-egg-impl.js → src/commands/make-this-awesome/cli.js} +17 -10
- package/src/commands/new/cli.d.ts +27 -0
- package/src/commands/new/cli.js +82 -0
- package/src/commands/run/cli.d.ts +25 -0
- package/src/commands/run/cli.js +83 -0
- package/{commands/run-long.md → src/commands/run/long-description.md} +0 -0
- package/src/commands/serve/cli.d.ts +16 -0
- package/src/commands/serve/cli.js +21 -0
- package/src/commands/test/cli.d.ts +16 -0
- package/src/commands/test/cli.js +23 -0
- package/{commands/test-long.md → src/commands/test/long-description.md} +0 -0
- package/{commands/update-impl.d.ts → src/commands/update/cli.d.ts} +26 -9
- package/{commands/update-impl.js → src/commands/update/cli.js} +363 -316
- package/{commands/update-long.md → src/commands/update/long-description.md} +0 -0
- package/src/commands/update/schematic/index.js +33 -20
- package/src/commands/version/cli.d.ts +18 -0
- package/{commands/version-impl.js → src/commands/version/cli.js} +56 -74
- package/src/typings-bazel.d.ts +14 -0
- package/src/typings.d.ts +1 -14
- package/{utilities → src/utilities}/color.d.ts +0 -0
- package/{utilities → src/utilities}/color.js +5 -1
- package/{utilities → src/utilities}/config.d.ts +6 -5
- package/{utilities → src/utilities}/config.js +33 -19
- package/src/utilities/environment-options.d.ts +12 -0
- package/src/utilities/environment-options.js +24 -0
- package/{utilities → src/utilities}/find-up.d.ts +0 -0
- package/{utilities → src/utilities}/find-up.js +5 -1
- package/{utilities → src/utilities}/json-file.d.ts +0 -0
- package/{utilities → src/utilities}/json-file.js +1 -0
- package/{utilities → src/utilities}/log-file.d.ts +0 -0
- package/{utilities → src/utilities}/log-file.js +0 -0
- package/src/utilities/memoize.d.ts +15 -0
- package/src/utilities/memoize.js +69 -0
- package/src/utilities/package-manager.d.ts +41 -0
- package/src/utilities/package-manager.js +287 -0
- package/{utilities → src/utilities}/package-metadata.d.ts +15 -37
- package/{utilities → src/utilities}/package-metadata.js +15 -27
- package/{utilities → src/utilities}/package-tree.d.ts +2 -2
- package/{utilities → src/utilities}/package-tree.js +5 -1
- package/{utilities → src/utilities}/project.d.ts +0 -0
- package/{utilities → src/utilities}/project.js +5 -1
- package/{utilities → src/utilities}/prompt.d.ts +2 -0
- package/{utilities → src/utilities}/prompt.js +25 -4
- package/{utilities → src/utilities}/spinner.d.ts +0 -0
- package/{utilities → src/utilities}/spinner.js +0 -0
- package/{utilities → src/utilities}/tty.d.ts +0 -0
- package/{utilities → src/utilities}/tty.js +0 -0
- package/{models → src/utilities}/version.d.ts +2 -1
- package/{models → src/utilities}/version.js +6 -6
- package/bin/postinstall/analytics-prompt.js +0 -27
- package/bin/postinstall/script.js +0 -16
- package/commands/add-impl.d.ts +0 -21
- package/commands/add.d.ts +0 -42
- package/commands/add.js +0 -10
- package/commands/add.json +0 -54
- package/commands/add.md +0 -10
- package/commands/analytics-impl.d.ts +0 -13
- package/commands/analytics-impl.js +0 -80
- package/commands/analytics-long.md +0 -8
- package/commands/analytics.d.ts +0 -46
- package/commands/analytics.js +0 -31
- package/commands/analytics.json +0 -37
- package/commands/build-impl.d.ts +0 -14
- package/commands/build-impl.js +0 -21
- package/commands/build.d.ts +0 -30
- package/commands/build.js +0 -10
- package/commands/build.json +0 -16
- package/commands/config-impl.d.ts +0 -15
- package/commands/config.d.ts +0 -34
- package/commands/config.js +0 -10
- package/commands/config.json +0 -43
- package/commands/definitions.json +0 -66
- package/commands/deploy-impl.d.ts +0 -15
- package/commands/deploy-impl.js +0 -36
- package/commands/deploy.d.ts +0 -30
- package/commands/deploy.js +0 -10
- package/commands/deploy.json +0 -34
- package/commands/doc-impl.d.ts +0 -13
- package/commands/doc.d.ts +0 -39
- package/commands/doc.js +0 -14
- package/commands/doc.json +0 -46
- package/commands/e2e-impl.d.ts +0 -16
- package/commands/e2e-impl.js +0 -36
- package/commands/e2e-long.md +0 -4
- package/commands/e2e.d.ts +0 -29
- package/commands/e2e.js +0 -10
- package/commands/e2e.json +0 -17
- package/commands/easter-egg-impl.d.ts +0 -12
- package/commands/easter-egg.d.ts +0 -14
- package/commands/easter-egg.js +0 -10
- package/commands/easter-egg.json +0 -12
- package/commands/extract-i18n-impl.d.ts +0 -14
- package/commands/extract-i18n-impl.js +0 -32
- package/commands/extract-i18n.d.ts +0 -29
- package/commands/extract-i18n.js +0 -10
- package/commands/extract-i18n.json +0 -17
- package/commands/generate-impl.d.ts +0 -18
- package/commands/generate-impl.js +0 -89
- package/commands/generate.d.ts +0 -37
- package/commands/generate.js +0 -10
- package/commands/generate.json +0 -31
- package/commands/help-impl.d.ts +0 -12
- package/commands/help-impl.js +0 -26
- package/commands/help-long.md +0 -7
- package/commands/help.d.ts +0 -17
- package/commands/help.js +0 -10
- package/commands/help.json +0 -13
- package/commands/lint-impl.d.ts +0 -16
- package/commands/lint-impl.js +0 -69
- package/commands/lint.d.ts +0 -29
- package/commands/lint.js +0 -10
- package/commands/lint.json +0 -36
- package/commands/new-impl.d.ts +0 -16
- package/commands/new-impl.js +0 -37
- package/commands/new.d.ts +0 -41
- package/commands/new.js +0 -10
- package/commands/new.json +0 -34
- package/commands/new.md +0 -16
- package/commands/run-impl.d.ts +0 -13
- package/commands/run-impl.js +0 -22
- package/commands/run.d.ts +0 -30
- package/commands/run.js +0 -10
- package/commands/run.json +0 -36
- package/commands/serve-impl.d.ts +0 -15
- package/commands/serve-impl.js +0 -24
- package/commands/serve.d.ts +0 -29
- package/commands/serve.js +0 -10
- package/commands/serve.json +0 -17
- package/commands/test-impl.d.ts +0 -15
- package/commands/test-impl.js +0 -22
- package/commands/test.d.ts +0 -29
- package/commands/test.js +0 -10
- package/commands/test.json +0 -17
- package/commands/update.d.ts +0 -61
- package/commands/update.js +0 -10
- package/commands/update.json +0 -78
- package/commands/version-impl.d.ts +0 -17
- package/commands/version.d.ts +0 -17
- package/commands/version.js +0 -10
- package/commands/version.json +0 -13
- package/commands.json +0 -20
- package/models/analytics.d.ts +0 -58
- package/models/analytics.js +0 -358
- package/models/architect-command.d.ts +0 -35
- package/models/architect-command.js +0 -364
- package/models/command-runner.d.ts +0 -24
- package/models/command-runner.js +0 -241
- package/models/command.d.ts +0 -34
- package/models/command.js +0 -143
- package/models/interface.d.ts +0 -196
- package/models/interface.js +0 -31
- package/models/parser.d.ts +0 -39
- package/models/parser.js +0 -349
- package/models/schematic-command.d.ts +0 -55
- package/models/schematic-command.js +0 -485
- package/utilities/INITIAL_COMMIT_MESSAGE.txt +0 -8
- package/utilities/install-package.d.ts +0 -16
- package/utilities/install-package.js +0 -193
- package/utilities/json-schema.d.ts +0 -17
- package/utilities/package-json.d.ts +0 -249
- package/utilities/package-manager.d.ts +0 -13
- package/utilities/package-manager.js +0 -106
package/models/command.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright Google LLC All Rights Reserved.
|
|
5
|
-
*
|
|
6
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.io/license
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.Command = void 0;
|
|
11
|
-
const core_1 = require("@angular-devkit/core");
|
|
12
|
-
const color_1 = require("../utilities/color");
|
|
13
|
-
const interface_1 = require("./interface");
|
|
14
|
-
class Command {
|
|
15
|
-
constructor(context, description, logger) {
|
|
16
|
-
this.context = context;
|
|
17
|
-
this.description = description;
|
|
18
|
-
this.logger = logger;
|
|
19
|
-
this.allowMissingWorkspace = false;
|
|
20
|
-
this.useReportAnalytics = true;
|
|
21
|
-
this.workspace = context.workspace;
|
|
22
|
-
this.analytics = context.analytics || new core_1.analytics.NoopAnalytics();
|
|
23
|
-
}
|
|
24
|
-
static setCommandMap(map) {
|
|
25
|
-
this.commandMap = map;
|
|
26
|
-
}
|
|
27
|
-
async initialize(options) { }
|
|
28
|
-
async printHelp() {
|
|
29
|
-
await this.printHelpUsage();
|
|
30
|
-
await this.printHelpOptions();
|
|
31
|
-
return 0;
|
|
32
|
-
}
|
|
33
|
-
async printJsonHelp() {
|
|
34
|
-
const replacer = (key, value) => key === 'name' ? core_1.strings.dasherize(value) : value;
|
|
35
|
-
this.logger.info(JSON.stringify(this.description, replacer, 2));
|
|
36
|
-
return 0;
|
|
37
|
-
}
|
|
38
|
-
async printHelpUsage() {
|
|
39
|
-
this.logger.info(this.description.description);
|
|
40
|
-
const name = this.description.name;
|
|
41
|
-
const args = this.description.options.filter((x) => x.positional !== undefined);
|
|
42
|
-
const opts = this.description.options.filter((x) => x.positional === undefined);
|
|
43
|
-
const argDisplay = args && args.length > 0 ? ' ' + args.map((a) => `<${a.name}>`).join(' ') : '';
|
|
44
|
-
const optionsDisplay = opts && opts.length > 0 ? ` [options]` : ``;
|
|
45
|
-
this.logger.info(`usage: ng ${name}${argDisplay}${optionsDisplay}`);
|
|
46
|
-
this.logger.info('');
|
|
47
|
-
}
|
|
48
|
-
async printHelpOptions(options = this.description.options) {
|
|
49
|
-
const args = options.filter((opt) => opt.positional !== undefined);
|
|
50
|
-
const opts = options.filter((opt) => opt.positional === undefined);
|
|
51
|
-
const formatDescription = (description) => ` ${description.replace(/\n/g, '\n ')}`;
|
|
52
|
-
if (args.length > 0) {
|
|
53
|
-
this.logger.info(`arguments:`);
|
|
54
|
-
args.forEach((o) => {
|
|
55
|
-
this.logger.info(` ${color_1.colors.cyan(o.name)}`);
|
|
56
|
-
if (o.description) {
|
|
57
|
-
this.logger.info(formatDescription(o.description));
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
if (options.length > 0) {
|
|
62
|
-
if (args.length > 0) {
|
|
63
|
-
this.logger.info('');
|
|
64
|
-
}
|
|
65
|
-
this.logger.info(`options:`);
|
|
66
|
-
opts
|
|
67
|
-
.filter((o) => !o.hidden)
|
|
68
|
-
.sort((a, b) => a.name.localeCompare(b.name))
|
|
69
|
-
.forEach((o) => {
|
|
70
|
-
const aliases = o.aliases && o.aliases.length > 0
|
|
71
|
-
? '(' + o.aliases.map((a) => `-${a}`).join(' ') + ')'
|
|
72
|
-
: '';
|
|
73
|
-
this.logger.info(` ${color_1.colors.cyan('--' + core_1.strings.dasherize(o.name))} ${aliases}`);
|
|
74
|
-
if (o.description) {
|
|
75
|
-
this.logger.info(formatDescription(o.description));
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
async validateScope(scope) {
|
|
81
|
-
switch (scope === undefined ? this.description.scope : scope) {
|
|
82
|
-
case interface_1.CommandScope.OutProject:
|
|
83
|
-
if (this.workspace) {
|
|
84
|
-
this.logger.fatal(core_1.tags.oneLine `
|
|
85
|
-
The ${this.description.name} command requires to be run outside of a project, but a
|
|
86
|
-
project definition was found at "${this.workspace.filePath}".
|
|
87
|
-
`);
|
|
88
|
-
// eslint-disable-next-line no-throw-literal
|
|
89
|
-
throw 1;
|
|
90
|
-
}
|
|
91
|
-
break;
|
|
92
|
-
case interface_1.CommandScope.InProject:
|
|
93
|
-
if (!this.workspace) {
|
|
94
|
-
this.logger.fatal(core_1.tags.oneLine `
|
|
95
|
-
The ${this.description.name} command requires to be run in an Angular project, but a
|
|
96
|
-
project definition could not be found.
|
|
97
|
-
`);
|
|
98
|
-
// eslint-disable-next-line no-throw-literal
|
|
99
|
-
throw 1;
|
|
100
|
-
}
|
|
101
|
-
break;
|
|
102
|
-
case interface_1.CommandScope.Everywhere:
|
|
103
|
-
// Can't miss this.
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
async reportAnalytics(paths, options, dimensions = [], metrics = []) {
|
|
108
|
-
for (const option of this.description.options) {
|
|
109
|
-
const ua = option.userAnalytics;
|
|
110
|
-
const v = options[option.name];
|
|
111
|
-
if (v !== undefined && !Array.isArray(v) && ua) {
|
|
112
|
-
dimensions[ua] = v;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
this.analytics.pageview('/command/' + paths.join('/'), { dimensions, metrics });
|
|
116
|
-
}
|
|
117
|
-
async validateAndRun(options) {
|
|
118
|
-
if (!(options.help === true || options.help === 'json' || options.help === 'JSON')) {
|
|
119
|
-
await this.validateScope();
|
|
120
|
-
}
|
|
121
|
-
let result = await this.initialize(options);
|
|
122
|
-
if (typeof result === 'number' && result !== 0) {
|
|
123
|
-
return result;
|
|
124
|
-
}
|
|
125
|
-
if (options.help === true) {
|
|
126
|
-
return this.printHelp();
|
|
127
|
-
}
|
|
128
|
-
else if (options.help === 'json' || options.help === 'JSON') {
|
|
129
|
-
return this.printJsonHelp();
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
const startTime = +new Date();
|
|
133
|
-
if (this.useReportAnalytics) {
|
|
134
|
-
await this.reportAnalytics([this.description.name], options);
|
|
135
|
-
}
|
|
136
|
-
result = await this.run(options);
|
|
137
|
-
const endTime = +new Date();
|
|
138
|
-
this.analytics.timing(this.description.name, 'duration', endTime - startTime);
|
|
139
|
-
return result;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
exports.Command = Command;
|
package/models/interface.d.ts
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7
|
-
*/
|
|
8
|
-
import { analytics, json, logging } from '@angular-devkit/core';
|
|
9
|
-
import { AngularWorkspace } from '../utilities/config';
|
|
10
|
-
/**
|
|
11
|
-
* Value type of arguments.
|
|
12
|
-
*/
|
|
13
|
-
export declare type Value = number | string | boolean | (number | string | boolean)[];
|
|
14
|
-
/**
|
|
15
|
-
* An object representing parsed arguments from the command line.
|
|
16
|
-
*/
|
|
17
|
-
export interface Arguments {
|
|
18
|
-
[argName: string]: Value | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* Extra arguments that were not parsed. Will be omitted if all arguments were parsed.
|
|
21
|
-
*/
|
|
22
|
-
'--'?: string[];
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* The base interface for Command, understood by the command runner.
|
|
26
|
-
*/
|
|
27
|
-
export interface CommandInterface<T extends Arguments = Arguments> {
|
|
28
|
-
printHelp(options: T): Promise<number>;
|
|
29
|
-
printJsonHelp(options: T): Promise<number>;
|
|
30
|
-
validateAndRun(options: T): Promise<number>;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Command constructor.
|
|
34
|
-
*/
|
|
35
|
-
export interface CommandConstructor {
|
|
36
|
-
new (context: CommandContext, description: CommandDescription, logger: logging.Logger): CommandInterface;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* A command runner context.
|
|
40
|
-
*/
|
|
41
|
-
export interface CommandContext {
|
|
42
|
-
currentDirectory: string;
|
|
43
|
-
root: string;
|
|
44
|
-
workspace?: AngularWorkspace;
|
|
45
|
-
analytics?: analytics.Analytics;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Value types of an Option.
|
|
49
|
-
*/
|
|
50
|
-
export declare enum OptionType {
|
|
51
|
-
Any = "any",
|
|
52
|
-
Array = "array",
|
|
53
|
-
Boolean = "boolean",
|
|
54
|
-
Number = "number",
|
|
55
|
-
String = "string"
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* An option description. This is exposed when using `ng --help=json`.
|
|
59
|
-
*/
|
|
60
|
-
export interface Option {
|
|
61
|
-
/**
|
|
62
|
-
* The name of the option.
|
|
63
|
-
*/
|
|
64
|
-
name: string;
|
|
65
|
-
/**
|
|
66
|
-
* A short description of the option.
|
|
67
|
-
*/
|
|
68
|
-
description: string;
|
|
69
|
-
/**
|
|
70
|
-
* The type of option value. If multiple types exist, this type will be the first one, and the
|
|
71
|
-
* types array will contain all types accepted.
|
|
72
|
-
*/
|
|
73
|
-
type: OptionType;
|
|
74
|
-
/**
|
|
75
|
-
* {@see type}
|
|
76
|
-
*/
|
|
77
|
-
types?: OptionType[];
|
|
78
|
-
/**
|
|
79
|
-
* If this field is set, only values contained in this field are valid. This array can be mixed
|
|
80
|
-
* types (strings, numbers, boolean). For example, if this field is "enum: ['hello', true]",
|
|
81
|
-
* then "type" will be either string or boolean, types will be at least both, and the values
|
|
82
|
-
* accepted will only be either 'hello' or true (not false or any other string).
|
|
83
|
-
* This mean that prefixing with `no-` will not work on this field.
|
|
84
|
-
*/
|
|
85
|
-
enum?: Value[];
|
|
86
|
-
/**
|
|
87
|
-
* If this option maps to a subcommand in the parent command, will contain all the subcommands
|
|
88
|
-
* supported. There is a maximum of 1 subcommand Option per command, and the type of this
|
|
89
|
-
* option will always be "string" (no other types). The value of this option will map into
|
|
90
|
-
* this map and return the extra information.
|
|
91
|
-
*/
|
|
92
|
-
subcommands?: {
|
|
93
|
-
[name: string]: SubCommandDescription;
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* Aliases supported by this option.
|
|
97
|
-
*/
|
|
98
|
-
aliases: string[];
|
|
99
|
-
/**
|
|
100
|
-
* Whether this option is required or not.
|
|
101
|
-
*/
|
|
102
|
-
required?: boolean;
|
|
103
|
-
/**
|
|
104
|
-
* Format field of this option.
|
|
105
|
-
*/
|
|
106
|
-
format?: string;
|
|
107
|
-
/**
|
|
108
|
-
* Whether this option should be hidden from the help output. It will still show up in JSON help.
|
|
109
|
-
*/
|
|
110
|
-
hidden?: boolean;
|
|
111
|
-
/**
|
|
112
|
-
* Default value of this option.
|
|
113
|
-
*/
|
|
114
|
-
default?: string | number | boolean;
|
|
115
|
-
/**
|
|
116
|
-
* If this option can be used as an argument, the position of the argument. Otherwise omitted.
|
|
117
|
-
*/
|
|
118
|
-
positional?: number;
|
|
119
|
-
/**
|
|
120
|
-
* Smart default object.
|
|
121
|
-
*/
|
|
122
|
-
$default?: OptionSmartDefault;
|
|
123
|
-
/**
|
|
124
|
-
* Whether or not to report this option to the Angular Team, and which custom field to use.
|
|
125
|
-
* If this is falsey, do not report this option.
|
|
126
|
-
*/
|
|
127
|
-
userAnalytics?: number;
|
|
128
|
-
/**
|
|
129
|
-
* Deprecation. If this flag is not false a warning will be shown on the console. Either `true`
|
|
130
|
-
* or a string to show the user as a notice.
|
|
131
|
-
*/
|
|
132
|
-
deprecated?: boolean | string;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Scope of the command.
|
|
136
|
-
*/
|
|
137
|
-
export declare enum CommandScope {
|
|
138
|
-
InProject = "in",
|
|
139
|
-
OutProject = "out",
|
|
140
|
-
Everywhere = "all",
|
|
141
|
-
Default = "in"
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* A description of a command and its options.
|
|
145
|
-
*/
|
|
146
|
-
export interface SubCommandDescription {
|
|
147
|
-
/**
|
|
148
|
-
* The name of the subcommand.
|
|
149
|
-
*/
|
|
150
|
-
name: string;
|
|
151
|
-
/**
|
|
152
|
-
* Short description (1-2 lines) of this sub command.
|
|
153
|
-
*/
|
|
154
|
-
description: string;
|
|
155
|
-
/**
|
|
156
|
-
* A long description of the sub command, in Markdown format.
|
|
157
|
-
*/
|
|
158
|
-
longDescription?: string;
|
|
159
|
-
/**
|
|
160
|
-
* Additional notes about usage of this sub command, in Markdown format.
|
|
161
|
-
*/
|
|
162
|
-
usageNotes?: string;
|
|
163
|
-
/**
|
|
164
|
-
* List of all supported options.
|
|
165
|
-
*/
|
|
166
|
-
options: Option[];
|
|
167
|
-
/**
|
|
168
|
-
* Aliases supported for this sub command.
|
|
169
|
-
*/
|
|
170
|
-
aliases: string[];
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* A description of a command, its metadata.
|
|
174
|
-
*/
|
|
175
|
-
export interface CommandDescription extends SubCommandDescription {
|
|
176
|
-
/**
|
|
177
|
-
* Scope of the command, whether it can be executed in a project, outside of a project or
|
|
178
|
-
* anywhere.
|
|
179
|
-
*/
|
|
180
|
-
scope: CommandScope;
|
|
181
|
-
/**
|
|
182
|
-
* Whether this command should be hidden from a list of all commands.
|
|
183
|
-
*/
|
|
184
|
-
hidden: boolean;
|
|
185
|
-
/**
|
|
186
|
-
* The constructor of the command, which should be extending the abstract Command<> class.
|
|
187
|
-
*/
|
|
188
|
-
impl: CommandConstructor;
|
|
189
|
-
}
|
|
190
|
-
export interface OptionSmartDefault {
|
|
191
|
-
$source: string;
|
|
192
|
-
[key: string]: json.JsonValue;
|
|
193
|
-
}
|
|
194
|
-
export interface CommandDescriptionMap {
|
|
195
|
-
[key: string]: CommandDescription;
|
|
196
|
-
}
|
package/models/interface.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright Google LLC All Rights Reserved.
|
|
5
|
-
*
|
|
6
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.io/license
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.CommandScope = exports.OptionType = void 0;
|
|
11
|
-
/**
|
|
12
|
-
* Value types of an Option.
|
|
13
|
-
*/
|
|
14
|
-
var OptionType;
|
|
15
|
-
(function (OptionType) {
|
|
16
|
-
OptionType["Any"] = "any";
|
|
17
|
-
OptionType["Array"] = "array";
|
|
18
|
-
OptionType["Boolean"] = "boolean";
|
|
19
|
-
OptionType["Number"] = "number";
|
|
20
|
-
OptionType["String"] = "string";
|
|
21
|
-
})(OptionType = exports.OptionType || (exports.OptionType = {}));
|
|
22
|
-
/**
|
|
23
|
-
* Scope of the command.
|
|
24
|
-
*/
|
|
25
|
-
var CommandScope;
|
|
26
|
-
(function (CommandScope) {
|
|
27
|
-
CommandScope["InProject"] = "in";
|
|
28
|
-
CommandScope["OutProject"] = "out";
|
|
29
|
-
CommandScope["Everywhere"] = "all";
|
|
30
|
-
CommandScope["Default"] = "in";
|
|
31
|
-
})(CommandScope = exports.CommandScope || (exports.CommandScope = {}));
|
package/models/parser.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7
|
-
*/
|
|
8
|
-
import { BaseException, logging } from '@angular-devkit/core';
|
|
9
|
-
import { Arguments, Option } from './interface';
|
|
10
|
-
export declare class ParseArgumentException extends BaseException {
|
|
11
|
-
readonly comments: string[];
|
|
12
|
-
readonly parsed: Arguments;
|
|
13
|
-
readonly ignored: string[];
|
|
14
|
-
constructor(comments: string[], parsed: Arguments, ignored: string[]);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Parse the arguments in a consistent way, but without having any option definition. This tries
|
|
18
|
-
* to assess what the user wants in a free form. For example, using `--name=false` will set the
|
|
19
|
-
* name properties to a boolean type.
|
|
20
|
-
* This should only be used when there's no schema available or if a schema is "true" (anything is
|
|
21
|
-
* valid).
|
|
22
|
-
*
|
|
23
|
-
* @param args Argument list to parse.
|
|
24
|
-
* @returns An object that contains a property per flags from the args.
|
|
25
|
-
*/
|
|
26
|
-
export declare function parseFreeFormArguments(args: string[]): Arguments;
|
|
27
|
-
/**
|
|
28
|
-
* Parse the arguments in a consistent way, from a list of standardized options.
|
|
29
|
-
* The result object will have a key per option name, with the `_` key reserved for positional
|
|
30
|
-
* arguments, and `--` will contain everything that did not match. Any key that don't have an
|
|
31
|
-
* option will be pushed back in `--` and removed from the object. If you need to validate that
|
|
32
|
-
* there's no additionalProperties, you need to check the `--` key.
|
|
33
|
-
*
|
|
34
|
-
* @param args The argument array to parse.
|
|
35
|
-
* @param options List of supported options. {@see Option}.
|
|
36
|
-
* @param logger Logger to use to warn users.
|
|
37
|
-
* @returns An object that contains a property per option.
|
|
38
|
-
*/
|
|
39
|
-
export declare function parseArguments(args: string[], options: Option[] | null, logger?: logging.Logger): Arguments;
|