@angular/cli 14.0.0-next.4 → 14.0.0-next.5
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/bin/postinstall/analytics-prompt.js +1 -1
- package/lib/cli/index.d.ts +1 -1
- package/lib/cli/index.js +16 -18
- package/lib/config/schema.json +4 -8
- package/lib/init.js +3 -3
- package/models/command.d.ts +14 -19
- package/models/command.js +13 -106
- package/models/interface.d.ts +3 -180
- package/models/interface.js +0 -22
- package/models/schematic-command.d.ts +6 -18
- package/models/schematic-command.js +16 -123
- package/package.json +15 -14
- package/{models → src/analytics}/analytics-collector.d.ts +0 -0
- package/{models → src/analytics}/analytics-collector.js +1 -1
- package/{models → src/analytics}/analytics.d.ts +2 -0
- package/{models → src/analytics}/analytics.js +33 -2
- package/src/command-builder/architect-base-command-module.d.ts +23 -0
- package/src/command-builder/architect-base-command-module.js +105 -0
- package/src/command-builder/architect-command-module.d.ts +22 -0
- package/src/command-builder/architect-command-module.js +110 -0
- package/src/command-builder/command-module.d.ts +85 -0
- package/src/command-builder/command-module.js +185 -0
- package/src/command-builder/command-runner.d.ts +10 -0
- package/src/command-builder/command-runner.js +146 -0
- package/src/command-builder/schematics-command-module.d.ts +31 -0
- package/src/command-builder/schematics-command-module.js +117 -0
- package/src/command-builder/utilities/json-help.d.ts +34 -0
- package/src/command-builder/utilities/json-help.js +90 -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/commands/add/add-impl.d.ts +22 -0
- package/{commands → src/commands/add}/add-impl.js +24 -32
- package/src/commands/add/cli.d.ts +23 -0
- package/src/commands/add/cli.js +48 -0
- package/{commands/add.md → src/commands/add/long-description.md} +0 -0
- package/src/commands/analytics/cli.d.ts +21 -0
- package/src/commands/analytics/cli.js +70 -0
- package/src/commands/analytics/long-description.md +10 -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/config/cli.d.ts +21 -0
- package/src/commands/config/cli.js +46 -0
- package/{commands → src/commands/config}/config-impl.d.ts +7 -5
- package/{commands → src/commands/config}/config-impl.js +3 -7
- package/{commands/config-long.md → src/commands/config/long-description.md} +2 -2
- package/src/commands/deploy/cli.d.ts +16 -0
- package/src/commands/deploy/cli.js +35 -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} +36 -11
- package/src/commands/e2e/cli.d.ts +17 -0
- package/src/commands/e2e/cli.js +34 -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 +27 -0
- package/src/commands/generate/cli.js +98 -0
- package/src/commands/generate/generate-impl.d.ts +19 -0
- package/src/commands/generate/generate-impl.js +49 -0
- package/src/commands/lint/cli.d.ts +16 -0
- package/src/commands/lint/cli.js +31 -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 +23 -0
- package/src/commands/new/cli.js +36 -0
- package/src/commands/new/new-impl.d.ts +18 -0
- package/{commands → src/commands/new}/new-impl.js +7 -6
- package/src/commands/run/cli.d.ts +23 -0
- package/src/commands/run/cli.js +59 -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/src/commands/update/cli.d.ts +29 -0
- package/src/commands/update/cli.js +83 -0
- package/{commands/update-long.md → src/commands/update/long-description.md} +0 -0
- package/src/commands/update/schematic/index.js +1 -1
- package/{commands → src/commands/update}/update-impl.d.ts +8 -6
- package/{commands → src/commands/update}/update-impl.js +22 -31
- package/src/commands/version/cli.d.ts +19 -0
- package/{commands/version-impl.js → src/commands/version/cli.js} +44 -38
- package/src/typings.d.ts +2 -2
- package/{utilities → src/utilities}/color.d.ts +0 -0
- package/{utilities → src/utilities}/color.js +0 -0
- package/{utilities → src/utilities}/config.d.ts +1 -1
- package/{utilities → src/utilities}/config.js +2 -5
- package/{utilities → src/utilities}/find-up.d.ts +0 -0
- package/{utilities → src/utilities}/find-up.js +0 -0
- package/{utilities → src/utilities}/install-package.d.ts +2 -2
- package/{utilities → src/utilities}/install-package.js +1 -1
- package/{utilities → src/utilities}/json-file.d.ts +0 -0
- package/{utilities → src/utilities}/json-file.js +0 -0
- package/{utilities → src/utilities}/log-file.d.ts +0 -0
- package/{utilities → src/utilities}/log-file.js +0 -0
- package/{utilities → src/utilities}/package-json.d.ts +0 -0
- package/{utilities → src/utilities}/package-json.js +0 -0
- package/{utilities → src/utilities}/package-manager.d.ts +1 -1
- package/{utilities → src/utilities}/package-manager.js +1 -1
- package/{utilities → src/utilities}/package-metadata.d.ts +0 -0
- package/{utilities → src/utilities}/package-metadata.js +0 -0
- package/{utilities → src/utilities}/package-tree.d.ts +0 -0
- package/{utilities → src/utilities}/package-tree.js +0 -0
- package/{utilities → src/utilities}/project.d.ts +0 -0
- package/{utilities → src/utilities}/project.js +0 -0
- package/{utilities → src/utilities}/prompt.d.ts +0 -0
- package/{utilities → src/utilities}/prompt.js +0 -0
- 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/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/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.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 -21
- package/commands/extract-i18n.d.ts +0 -29
- package/commands/extract-i18n.js +0 -10
- package/commands/extract-i18n.json +0 -15
- 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.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/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/parser.d.ts +0 -39
- package/models/parser.js +0 -349
- package/utilities/json-schema.d.ts +0 -17
|
@@ -1,35 +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 { Architect, Target } from '@angular-devkit/architect';
|
|
9
|
-
import { WorkspaceNodeModulesArchitectHost } from '@angular-devkit/architect/node';
|
|
10
|
-
import { json } from '@angular-devkit/core';
|
|
11
|
-
import { BaseCommandOptions, Command } from './command';
|
|
12
|
-
import { Arguments } from './interface';
|
|
13
|
-
export interface ArchitectCommandOptions extends BaseCommandOptions {
|
|
14
|
-
project?: string;
|
|
15
|
-
configuration?: string;
|
|
16
|
-
prod?: boolean;
|
|
17
|
-
target?: string;
|
|
18
|
-
}
|
|
19
|
-
export declare abstract class ArchitectCommand<T extends ArchitectCommandOptions = ArchitectCommandOptions> extends Command<T> {
|
|
20
|
-
protected _architect: Architect;
|
|
21
|
-
protected _architectHost: WorkspaceNodeModulesArchitectHost;
|
|
22
|
-
protected _registry: json.schema.SchemaRegistry;
|
|
23
|
-
protected readonly useReportAnalytics = false;
|
|
24
|
-
protected multiTarget: boolean;
|
|
25
|
-
target: string | undefined;
|
|
26
|
-
missingTargetError: string | undefined;
|
|
27
|
-
protected onMissingTarget(projectName?: string): Promise<void | number>;
|
|
28
|
-
initialize(options: T & Arguments): Promise<number | void>;
|
|
29
|
-
private warnOnMissingNodeModules;
|
|
30
|
-
run(options: ArchitectCommandOptions & Arguments): Promise<number>;
|
|
31
|
-
protected runSingleTarget(target: Target, targetOptions: string[]): Promise<0 | 1>;
|
|
32
|
-
protected runArchitectTarget(options: ArchitectCommandOptions & Arguments): Promise<number>;
|
|
33
|
-
private getProjectNamesByTarget;
|
|
34
|
-
private _makeTargetSpecifier;
|
|
35
|
-
}
|
|
@@ -1,364 +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
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
-
if (mod && mod.__esModule) return mod;
|
|
23
|
-
var result = {};
|
|
24
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
-
__setModuleDefault(result, mod);
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.ArchitectCommand = void 0;
|
|
30
|
-
const architect_1 = require("@angular-devkit/architect");
|
|
31
|
-
const node_1 = require("@angular-devkit/architect/node");
|
|
32
|
-
const core_1 = require("@angular-devkit/core");
|
|
33
|
-
const fs_1 = require("fs");
|
|
34
|
-
const path = __importStar(require("path"));
|
|
35
|
-
const json_schema_1 = require("../utilities/json-schema");
|
|
36
|
-
const package_manager_1 = require("../utilities/package-manager");
|
|
37
|
-
const analytics_1 = require("./analytics");
|
|
38
|
-
const command_1 = require("./command");
|
|
39
|
-
const parser_1 = require("./parser");
|
|
40
|
-
class ArchitectCommand extends command_1.Command {
|
|
41
|
-
constructor() {
|
|
42
|
-
super(...arguments);
|
|
43
|
-
this.useReportAnalytics = false;
|
|
44
|
-
// If this command supports running multiple targets.
|
|
45
|
-
this.multiTarget = false;
|
|
46
|
-
}
|
|
47
|
-
async onMissingTarget(projectName) {
|
|
48
|
-
if (this.missingTargetError) {
|
|
49
|
-
this.logger.fatal(this.missingTargetError);
|
|
50
|
-
return 1;
|
|
51
|
-
}
|
|
52
|
-
if (projectName) {
|
|
53
|
-
this.logger.fatal(`Project '${projectName}' does not support the '${this.target}' target.`);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
this.logger.fatal(`No projects support the '${this.target}' target.`);
|
|
57
|
-
}
|
|
58
|
-
return 1;
|
|
59
|
-
}
|
|
60
|
-
// eslint-disable-next-line max-lines-per-function
|
|
61
|
-
async initialize(options) {
|
|
62
|
-
this._registry = new core_1.json.schema.CoreSchemaRegistry();
|
|
63
|
-
this._registry.addPostTransform(core_1.json.schema.transforms.addUndefinedDefaults);
|
|
64
|
-
this._registry.useXDeprecatedProvider((msg) => this.logger.warn(msg));
|
|
65
|
-
if (!this.workspace) {
|
|
66
|
-
this.logger.fatal('A workspace is required for this command.');
|
|
67
|
-
return 1;
|
|
68
|
-
}
|
|
69
|
-
this._architectHost = new node_1.WorkspaceNodeModulesArchitectHost(this.workspace, this.workspace.basePath);
|
|
70
|
-
this._architect = new architect_1.Architect(this._architectHost, this._registry);
|
|
71
|
-
if (!this.target) {
|
|
72
|
-
if (options.help) {
|
|
73
|
-
// This is a special case where we just return.
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const specifier = this._makeTargetSpecifier(options);
|
|
77
|
-
if (!specifier.project || !specifier.target) {
|
|
78
|
-
this.logger.fatal('Cannot determine project or target for command.');
|
|
79
|
-
return 1;
|
|
80
|
-
}
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
let projectName = options.project;
|
|
84
|
-
if (projectName && !this.workspace.projects.has(projectName)) {
|
|
85
|
-
this.logger.fatal(`Project '${projectName}' does not exist.`);
|
|
86
|
-
return 1;
|
|
87
|
-
}
|
|
88
|
-
const commandLeftovers = options['--'];
|
|
89
|
-
const targetProjectNames = [];
|
|
90
|
-
for (const [name, project] of this.workspace.projects) {
|
|
91
|
-
if (project.targets.has(this.target)) {
|
|
92
|
-
targetProjectNames.push(name);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (projectName && !targetProjectNames.includes(projectName)) {
|
|
96
|
-
return await this.onMissingTarget(projectName);
|
|
97
|
-
}
|
|
98
|
-
if (targetProjectNames.length === 0) {
|
|
99
|
-
return await this.onMissingTarget();
|
|
100
|
-
}
|
|
101
|
-
if (!projectName && commandLeftovers && commandLeftovers.length > 0) {
|
|
102
|
-
const builderNames = new Set();
|
|
103
|
-
const leftoverMap = new Map();
|
|
104
|
-
let potentialProjectNames = new Set(targetProjectNames);
|
|
105
|
-
for (const name of targetProjectNames) {
|
|
106
|
-
const builderName = await this._architectHost.getBuilderNameForTarget({
|
|
107
|
-
project: name,
|
|
108
|
-
target: this.target,
|
|
109
|
-
});
|
|
110
|
-
if (this.multiTarget) {
|
|
111
|
-
builderNames.add(builderName);
|
|
112
|
-
}
|
|
113
|
-
let builderDesc;
|
|
114
|
-
try {
|
|
115
|
-
builderDesc = await this._architectHost.resolveBuilder(builderName);
|
|
116
|
-
}
|
|
117
|
-
catch (e) {
|
|
118
|
-
if (e.code === 'MODULE_NOT_FOUND') {
|
|
119
|
-
await this.warnOnMissingNodeModules(this.workspace.basePath);
|
|
120
|
-
this.logger.fatal(`Could not find the '${builderName}' builder's node package.`);
|
|
121
|
-
return 1;
|
|
122
|
-
}
|
|
123
|
-
throw e;
|
|
124
|
-
}
|
|
125
|
-
const optionDefs = await (0, json_schema_1.parseJsonSchemaToOptions)(this._registry, builderDesc.optionSchema);
|
|
126
|
-
const parsedOptions = (0, parser_1.parseArguments)([...commandLeftovers], optionDefs);
|
|
127
|
-
const builderLeftovers = parsedOptions['--'] || [];
|
|
128
|
-
leftoverMap.set(name, { optionDefs, parsedOptions });
|
|
129
|
-
potentialProjectNames = new Set(builderLeftovers.filter((x) => potentialProjectNames.has(x)));
|
|
130
|
-
}
|
|
131
|
-
if (potentialProjectNames.size === 1) {
|
|
132
|
-
projectName = [...potentialProjectNames][0];
|
|
133
|
-
// remove the project name from the leftovers
|
|
134
|
-
const optionInfo = leftoverMap.get(projectName);
|
|
135
|
-
if (optionInfo) {
|
|
136
|
-
const locations = [];
|
|
137
|
-
let i = 0;
|
|
138
|
-
while (i < commandLeftovers.length) {
|
|
139
|
-
i = commandLeftovers.indexOf(projectName, i + 1);
|
|
140
|
-
if (i === -1) {
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
locations.push(i);
|
|
144
|
-
}
|
|
145
|
-
delete optionInfo.parsedOptions['--'];
|
|
146
|
-
for (const location of locations) {
|
|
147
|
-
const tempLeftovers = [...commandLeftovers];
|
|
148
|
-
tempLeftovers.splice(location, 1);
|
|
149
|
-
const tempArgs = (0, parser_1.parseArguments)([...tempLeftovers], optionInfo.optionDefs);
|
|
150
|
-
delete tempArgs['--'];
|
|
151
|
-
if (JSON.stringify(optionInfo.parsedOptions) === JSON.stringify(tempArgs)) {
|
|
152
|
-
options['--'] = tempLeftovers;
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
if (!projectName && this.multiTarget && builderNames.size > 1) {
|
|
159
|
-
this.logger.fatal(core_1.tags.oneLine `
|
|
160
|
-
Architect commands with command line overrides cannot target different builders. The
|
|
161
|
-
'${this.target}' target would run on projects ${targetProjectNames.join()} which have the
|
|
162
|
-
following builders: ${'\n ' + [...builderNames].join('\n ')}
|
|
163
|
-
`);
|
|
164
|
-
return 1;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
if (!projectName && !this.multiTarget) {
|
|
168
|
-
const defaultProjectName = this.workspace.extensions['defaultProject'];
|
|
169
|
-
if (targetProjectNames.length === 1) {
|
|
170
|
-
projectName = targetProjectNames[0];
|
|
171
|
-
}
|
|
172
|
-
else if (defaultProjectName && targetProjectNames.includes(defaultProjectName)) {
|
|
173
|
-
projectName = defaultProjectName;
|
|
174
|
-
}
|
|
175
|
-
else if (options.help) {
|
|
176
|
-
// This is a special case where we just return.
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
this.logger.fatal(this.missingTargetError || 'Cannot determine project or target for command.');
|
|
181
|
-
return 1;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
options.project = projectName;
|
|
185
|
-
const builderConf = await this._architectHost.getBuilderNameForTarget({
|
|
186
|
-
project: projectName || (targetProjectNames.length > 0 ? targetProjectNames[0] : ''),
|
|
187
|
-
target: this.target,
|
|
188
|
-
});
|
|
189
|
-
let builderDesc;
|
|
190
|
-
try {
|
|
191
|
-
builderDesc = await this._architectHost.resolveBuilder(builderConf);
|
|
192
|
-
}
|
|
193
|
-
catch (e) {
|
|
194
|
-
if (e.code === 'MODULE_NOT_FOUND') {
|
|
195
|
-
await this.warnOnMissingNodeModules(this.workspace.basePath);
|
|
196
|
-
this.logger.fatal(`Could not find the '${builderConf}' builder's node package.`);
|
|
197
|
-
return 1;
|
|
198
|
-
}
|
|
199
|
-
throw e;
|
|
200
|
-
}
|
|
201
|
-
this.description.options.push(...(await (0, json_schema_1.parseJsonSchemaToOptions)(this._registry, builderDesc.optionSchema)));
|
|
202
|
-
// Update options to remove analytics from options if the builder isn't safelisted.
|
|
203
|
-
for (const o of this.description.options) {
|
|
204
|
-
if (o.userAnalytics && !(0, analytics_1.isPackageNameSafeForAnalytics)(builderConf)) {
|
|
205
|
-
o.userAnalytics = undefined;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
async warnOnMissingNodeModules(basePath) {
|
|
210
|
-
// Check for a `node_modules` directory (npm, yarn non-PnP, etc.)
|
|
211
|
-
if ((0, fs_1.existsSync)(path.resolve(basePath, 'node_modules'))) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
// Check for yarn PnP files
|
|
215
|
-
if ((0, fs_1.existsSync)(path.resolve(basePath, '.pnp.js')) ||
|
|
216
|
-
(0, fs_1.existsSync)(path.resolve(basePath, '.pnp.cjs')) ||
|
|
217
|
-
(0, fs_1.existsSync)(path.resolve(basePath, '.pnp.mjs'))) {
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
const packageManager = await (0, package_manager_1.getPackageManager)(basePath);
|
|
221
|
-
this.logger.warn(`Node packages may not be installed. Try installing with '${packageManager} install'.`);
|
|
222
|
-
}
|
|
223
|
-
async run(options) {
|
|
224
|
-
return await this.runArchitectTarget(options);
|
|
225
|
-
}
|
|
226
|
-
async runSingleTarget(target, targetOptions) {
|
|
227
|
-
// We need to build the builderSpec twice because architect does not understand
|
|
228
|
-
// overrides separately (getting the configuration builds the whole project, including
|
|
229
|
-
// overrides).
|
|
230
|
-
const builderConf = await this._architectHost.getBuilderNameForTarget(target);
|
|
231
|
-
let builderDesc;
|
|
232
|
-
try {
|
|
233
|
-
builderDesc = await this._architectHost.resolveBuilder(builderConf);
|
|
234
|
-
}
|
|
235
|
-
catch (e) {
|
|
236
|
-
if (e.code === 'MODULE_NOT_FOUND') {
|
|
237
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
238
|
-
await this.warnOnMissingNodeModules(this.workspace.basePath);
|
|
239
|
-
this.logger.fatal(`Could not find the '${builderConf}' builder's node package.`);
|
|
240
|
-
return 1;
|
|
241
|
-
}
|
|
242
|
-
throw e;
|
|
243
|
-
}
|
|
244
|
-
const targetOptionArray = await (0, json_schema_1.parseJsonSchemaToOptions)(this._registry, builderDesc.optionSchema);
|
|
245
|
-
const overrides = (0, parser_1.parseArguments)(targetOptions, targetOptionArray, this.logger);
|
|
246
|
-
const allowAdditionalProperties = typeof builderDesc.optionSchema === 'object' && builderDesc.optionSchema.additionalProperties;
|
|
247
|
-
if (overrides['--'] && !allowAdditionalProperties) {
|
|
248
|
-
(overrides['--'] || []).forEach((additional) => {
|
|
249
|
-
this.logger.fatal(`Unknown option: '${additional.split(/=/)[0]}'`);
|
|
250
|
-
});
|
|
251
|
-
return 1;
|
|
252
|
-
}
|
|
253
|
-
await this.reportAnalytics([this.description.name], {
|
|
254
|
-
...(await this._architectHost.getOptionsForTarget(target)),
|
|
255
|
-
...overrides,
|
|
256
|
-
});
|
|
257
|
-
const run = await this._architect.scheduleTarget(target, overrides, {
|
|
258
|
-
logger: this.logger,
|
|
259
|
-
analytics: (0, analytics_1.isPackageNameSafeForAnalytics)(builderConf) ? this.analytics : undefined,
|
|
260
|
-
});
|
|
261
|
-
const { error, success } = await run.output.toPromise();
|
|
262
|
-
await run.stop();
|
|
263
|
-
if (error) {
|
|
264
|
-
this.logger.error(error);
|
|
265
|
-
}
|
|
266
|
-
return success ? 0 : 1;
|
|
267
|
-
}
|
|
268
|
-
async runArchitectTarget(options) {
|
|
269
|
-
var _a;
|
|
270
|
-
const extra = options['--'] || [];
|
|
271
|
-
try {
|
|
272
|
-
const targetSpec = this._makeTargetSpecifier(options);
|
|
273
|
-
if (!targetSpec.project && this.target) {
|
|
274
|
-
// This runs each target sequentially.
|
|
275
|
-
// Running them in parallel would jumble the log messages.
|
|
276
|
-
let result = 0;
|
|
277
|
-
for (const project of this.getProjectNamesByTarget(this.target)) {
|
|
278
|
-
result |= await this.runSingleTarget({ ...targetSpec, project }, extra);
|
|
279
|
-
}
|
|
280
|
-
return result;
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
return await this.runSingleTarget(targetSpec, extra);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
catch (e) {
|
|
287
|
-
if (e instanceof core_1.schema.SchemaValidationException) {
|
|
288
|
-
const newErrors = [];
|
|
289
|
-
for (const schemaError of e.errors) {
|
|
290
|
-
if (schemaError.keyword === 'additionalProperties') {
|
|
291
|
-
const unknownProperty = (_a = schemaError.params) === null || _a === void 0 ? void 0 : _a.additionalProperty;
|
|
292
|
-
if (unknownProperty in options) {
|
|
293
|
-
const dashes = unknownProperty.length === 1 ? '-' : '--';
|
|
294
|
-
this.logger.fatal(`Unknown option: '${dashes}${unknownProperty}'`);
|
|
295
|
-
continue;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
newErrors.push(schemaError);
|
|
299
|
-
}
|
|
300
|
-
if (newErrors.length > 0) {
|
|
301
|
-
this.logger.error(new core_1.schema.SchemaValidationException(newErrors).message);
|
|
302
|
-
}
|
|
303
|
-
return 1;
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
throw e;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
getProjectNamesByTarget(targetName) {
|
|
311
|
-
const allProjectsForTargetName = [];
|
|
312
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
313
|
-
for (const [name, project] of this.workspace.projects) {
|
|
314
|
-
if (project.targets.has(targetName)) {
|
|
315
|
-
allProjectsForTargetName.push(name);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
if (this.multiTarget) {
|
|
319
|
-
// For multi target commands, we always list all projects that have the target.
|
|
320
|
-
return allProjectsForTargetName;
|
|
321
|
-
}
|
|
322
|
-
else {
|
|
323
|
-
// For single target commands, we try the default project first,
|
|
324
|
-
// then the full list if it has a single project, then error out.
|
|
325
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
326
|
-
const maybeDefaultProject = this.workspace.extensions['defaultProject'];
|
|
327
|
-
if (maybeDefaultProject && allProjectsForTargetName.includes(maybeDefaultProject)) {
|
|
328
|
-
return [maybeDefaultProject];
|
|
329
|
-
}
|
|
330
|
-
if (allProjectsForTargetName.length === 1) {
|
|
331
|
-
return allProjectsForTargetName;
|
|
332
|
-
}
|
|
333
|
-
throw new Error(`Could not determine a single project for the '${targetName}' target.`);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
_makeTargetSpecifier(commandOptions) {
|
|
337
|
-
let project, target, configuration;
|
|
338
|
-
if (commandOptions.target) {
|
|
339
|
-
[project, target, configuration] = commandOptions.target.split(':');
|
|
340
|
-
if (commandOptions.configuration) {
|
|
341
|
-
configuration = commandOptions.configuration;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
else {
|
|
345
|
-
project = commandOptions.project;
|
|
346
|
-
target = this.target;
|
|
347
|
-
if (commandOptions.configuration) {
|
|
348
|
-
configuration = `${configuration ? `${configuration},` : ''}${commandOptions.configuration}`;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
if (!project) {
|
|
352
|
-
project = '';
|
|
353
|
-
}
|
|
354
|
-
if (!target) {
|
|
355
|
-
target = '';
|
|
356
|
-
}
|
|
357
|
-
return {
|
|
358
|
-
project,
|
|
359
|
-
configuration: configuration || '',
|
|
360
|
-
target,
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
exports.ArchitectCommand = ArchitectCommand;
|
|
@@ -1,24 +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, logging } from '@angular-devkit/core';
|
|
9
|
-
import { AngularWorkspace } from '../utilities/config';
|
|
10
|
-
export interface CommandMapOptions {
|
|
11
|
-
[key: string]: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Run a command.
|
|
15
|
-
* @param args Raw unparsed arguments.
|
|
16
|
-
* @param logger The logger to use.
|
|
17
|
-
* @param workspace Workspace information.
|
|
18
|
-
* @param commands The map of supported commands.
|
|
19
|
-
* @param options Additional options.
|
|
20
|
-
*/
|
|
21
|
-
export declare function runCommand(args: string[], logger: logging.Logger, workspace: AngularWorkspace | undefined, commands?: CommandMapOptions, options?: {
|
|
22
|
-
analytics?: analytics.Analytics;
|
|
23
|
-
currentDirectory: string;
|
|
24
|
-
}): Promise<number | void>;
|
package/models/command-runner.js
DELETED
|
@@ -1,241 +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
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
-
if (mod && mod.__esModule) return mod;
|
|
23
|
-
var result = {};
|
|
24
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
-
__setModuleDefault(result, mod);
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.runCommand = void 0;
|
|
30
|
-
const core_1 = require("@angular-devkit/core");
|
|
31
|
-
const fs_1 = require("fs");
|
|
32
|
-
const path_1 = require("path");
|
|
33
|
-
const json_file_1 = require("../utilities/json-file");
|
|
34
|
-
const json_schema_1 = require("../utilities/json-schema");
|
|
35
|
-
const analytics_1 = require("./analytics");
|
|
36
|
-
const command_1 = require("./command");
|
|
37
|
-
const parser = __importStar(require("./parser"));
|
|
38
|
-
// NOTE: Update commands.json if changing this. It's still deep imported in one CI validation
|
|
39
|
-
const standardCommands = {
|
|
40
|
-
'add': '../commands/add.json',
|
|
41
|
-
'analytics': '../commands/analytics.json',
|
|
42
|
-
'build': '../commands/build.json',
|
|
43
|
-
'deploy': '../commands/deploy.json',
|
|
44
|
-
'config': '../commands/config.json',
|
|
45
|
-
'doc': '../commands/doc.json',
|
|
46
|
-
'e2e': '../commands/e2e.json',
|
|
47
|
-
'extract-i18n': '../commands/extract-i18n.json',
|
|
48
|
-
'make-this-awesome': '../commands/easter-egg.json',
|
|
49
|
-
'generate': '../commands/generate.json',
|
|
50
|
-
'help': '../commands/help.json',
|
|
51
|
-
'lint': '../commands/lint.json',
|
|
52
|
-
'new': '../commands/new.json',
|
|
53
|
-
'run': '../commands/run.json',
|
|
54
|
-
'serve': '../commands/serve.json',
|
|
55
|
-
'test': '../commands/test.json',
|
|
56
|
-
'update': '../commands/update.json',
|
|
57
|
-
'version': '../commands/version.json',
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Create the analytics instance.
|
|
61
|
-
* @private
|
|
62
|
-
*/
|
|
63
|
-
async function _createAnalytics(workspace, skipPrompt = false) {
|
|
64
|
-
let config = await (0, analytics_1.getGlobalAnalytics)();
|
|
65
|
-
// If in workspace and global analytics is enabled, defer to workspace level
|
|
66
|
-
if (workspace && config) {
|
|
67
|
-
const skipAnalytics = skipPrompt ||
|
|
68
|
-
(process.env['NG_CLI_ANALYTICS'] &&
|
|
69
|
-
(process.env['NG_CLI_ANALYTICS'].toLowerCase() === 'false' ||
|
|
70
|
-
process.env['NG_CLI_ANALYTICS'] === '0'));
|
|
71
|
-
// TODO: This should honor the `no-interactive` option.
|
|
72
|
-
// It is currently not an `ng` option but rather only an option for specific commands.
|
|
73
|
-
// The concept of `ng`-wide options are needed to cleanly handle this.
|
|
74
|
-
if (!skipAnalytics && !(await (0, analytics_1.hasWorkspaceAnalyticsConfiguration)())) {
|
|
75
|
-
await (0, analytics_1.promptProjectAnalytics)();
|
|
76
|
-
}
|
|
77
|
-
config = await (0, analytics_1.getWorkspaceAnalytics)();
|
|
78
|
-
}
|
|
79
|
-
const maybeSharedAnalytics = await (0, analytics_1.getSharedAnalytics)();
|
|
80
|
-
if (config && maybeSharedAnalytics) {
|
|
81
|
-
return new core_1.analytics.MultiAnalytics([config, maybeSharedAnalytics]);
|
|
82
|
-
}
|
|
83
|
-
else if (config) {
|
|
84
|
-
return config;
|
|
85
|
-
}
|
|
86
|
-
else if (maybeSharedAnalytics) {
|
|
87
|
-
return maybeSharedAnalytics;
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
return new core_1.analytics.NoopAnalytics();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
async function loadCommandDescription(name, path, registry) {
|
|
94
|
-
const schemaPath = (0, path_1.resolve)(__dirname, path);
|
|
95
|
-
const schema = (0, json_file_1.readAndParseJson)(schemaPath);
|
|
96
|
-
if (!(0, core_1.isJsonObject)(schema)) {
|
|
97
|
-
throw new Error('Invalid command JSON loaded from ' + JSON.stringify(schemaPath));
|
|
98
|
-
}
|
|
99
|
-
return (0, json_schema_1.parseJsonSchemaToCommandDescription)(name, schemaPath, registry, schema);
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Run a command.
|
|
103
|
-
* @param args Raw unparsed arguments.
|
|
104
|
-
* @param logger The logger to use.
|
|
105
|
-
* @param workspace Workspace information.
|
|
106
|
-
* @param commands The map of supported commands.
|
|
107
|
-
* @param options Additional options.
|
|
108
|
-
*/
|
|
109
|
-
async function runCommand(args, logger, workspace, commands = standardCommands, options = {
|
|
110
|
-
currentDirectory: process.cwd(),
|
|
111
|
-
}) {
|
|
112
|
-
var _a;
|
|
113
|
-
// This registry is exclusively used for flattening schemas, and not for validating.
|
|
114
|
-
const registry = new core_1.schema.CoreSchemaRegistry([]);
|
|
115
|
-
registry.registerUriHandler((uri) => {
|
|
116
|
-
if (uri.startsWith('ng-cli://')) {
|
|
117
|
-
const content = (0, fs_1.readFileSync)((0, path_1.join)(__dirname, '..', uri.substr('ng-cli://'.length)), 'utf-8');
|
|
118
|
-
return Promise.resolve(JSON.parse(content));
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
let commandName = undefined;
|
|
125
|
-
for (let i = 0; i < args.length; i++) {
|
|
126
|
-
const arg = args[i];
|
|
127
|
-
if (!arg.startsWith('-')) {
|
|
128
|
-
commandName = arg;
|
|
129
|
-
args.splice(i, 1);
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
let description = null;
|
|
134
|
-
// if no commands were found, use `help`.
|
|
135
|
-
if (!commandName) {
|
|
136
|
-
if (args.length === 1 && args[0] === '--version') {
|
|
137
|
-
commandName = 'version';
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
commandName = 'help';
|
|
141
|
-
}
|
|
142
|
-
if (!(commandName in commands)) {
|
|
143
|
-
logger.error(core_1.tags.stripIndent `
|
|
144
|
-
The "${commandName}" command seems to be disabled.
|
|
145
|
-
This is an issue with the CLI itself. If you see this comment, please report it and
|
|
146
|
-
provide your repository.
|
|
147
|
-
`);
|
|
148
|
-
return 1;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
if (commandName in commands) {
|
|
152
|
-
description = await loadCommandDescription(commandName, commands[commandName], registry);
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
const commandNames = Object.keys(commands);
|
|
156
|
-
// Optimize loading for common aliases
|
|
157
|
-
if (commandName.length === 1) {
|
|
158
|
-
commandNames.sort((a, b) => {
|
|
159
|
-
const aMatch = a[0] === commandName;
|
|
160
|
-
const bMatch = b[0] === commandName;
|
|
161
|
-
if (aMatch && !bMatch) {
|
|
162
|
-
return -1;
|
|
163
|
-
}
|
|
164
|
-
else if (!aMatch && bMatch) {
|
|
165
|
-
return 1;
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
return 0;
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
for (const name of commandNames) {
|
|
173
|
-
const aliasDesc = await loadCommandDescription(name, commands[name], registry);
|
|
174
|
-
const aliases = aliasDesc.aliases;
|
|
175
|
-
if (aliases && aliases.some((alias) => alias === commandName)) {
|
|
176
|
-
commandName = name;
|
|
177
|
-
description = aliasDesc;
|
|
178
|
-
break;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
if (!description) {
|
|
183
|
-
const commandsDistance = {};
|
|
184
|
-
const name = commandName;
|
|
185
|
-
const allCommands = Object.keys(commands).sort((a, b) => {
|
|
186
|
-
if (!(a in commandsDistance)) {
|
|
187
|
-
commandsDistance[a] = core_1.strings.levenshtein(a, name);
|
|
188
|
-
}
|
|
189
|
-
if (!(b in commandsDistance)) {
|
|
190
|
-
commandsDistance[b] = core_1.strings.levenshtein(b, name);
|
|
191
|
-
}
|
|
192
|
-
return commandsDistance[a] - commandsDistance[b];
|
|
193
|
-
});
|
|
194
|
-
logger.error(core_1.tags.stripIndent `
|
|
195
|
-
The specified command ("${commandName}") is invalid. For a list of available options,
|
|
196
|
-
run "ng help".
|
|
197
|
-
|
|
198
|
-
Did you mean "${allCommands[0]}"?
|
|
199
|
-
`);
|
|
200
|
-
return 1;
|
|
201
|
-
}
|
|
202
|
-
try {
|
|
203
|
-
const parsedOptions = parser.parseArguments(args, description.options, logger);
|
|
204
|
-
command_1.Command.setCommandMap(async () => {
|
|
205
|
-
const map = {};
|
|
206
|
-
for (const [name, path] of Object.entries(commands)) {
|
|
207
|
-
map[name] = await loadCommandDescription(name, path, registry);
|
|
208
|
-
}
|
|
209
|
-
return map;
|
|
210
|
-
});
|
|
211
|
-
const analytics = options.analytics || (await _createAnalytics(!!workspace, description.name === 'update'));
|
|
212
|
-
const context = {
|
|
213
|
-
workspace,
|
|
214
|
-
analytics,
|
|
215
|
-
currentDirectory: options.currentDirectory,
|
|
216
|
-
root: (_a = workspace === null || workspace === void 0 ? void 0 : workspace.basePath) !== null && _a !== void 0 ? _a : options.currentDirectory,
|
|
217
|
-
};
|
|
218
|
-
const command = new description.impl(context, description, logger);
|
|
219
|
-
// Flush on an interval (if the event loop is waiting).
|
|
220
|
-
let analyticsFlushPromise = Promise.resolve();
|
|
221
|
-
const analyticsFlushInterval = setInterval(() => {
|
|
222
|
-
analyticsFlushPromise = analyticsFlushPromise.then(() => analytics.flush());
|
|
223
|
-
}, 1000);
|
|
224
|
-
const result = await command.validateAndRun(parsedOptions);
|
|
225
|
-
// Flush one last time.
|
|
226
|
-
clearInterval(analyticsFlushInterval);
|
|
227
|
-
await analyticsFlushPromise.then(() => analytics.flush());
|
|
228
|
-
return result;
|
|
229
|
-
}
|
|
230
|
-
catch (e) {
|
|
231
|
-
if (e instanceof parser.ParseArgumentException) {
|
|
232
|
-
logger.fatal('Cannot parse arguments. See below for the reasons.');
|
|
233
|
-
logger.fatal(' ' + e.comments.join('\n '));
|
|
234
|
-
return 1;
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
throw e;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
exports.runCommand = runCommand;
|