@angular/cli 14.0.0-next.5 → 14.0.0-next.6
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/postinstall/analytics-prompt.js +2 -2
- package/lib/config/schema.json +4 -4
- package/lib/config/workspace-schema.d.ts +1 -1
- package/lib/init.js +5 -1
- package/package.json +13 -13
- package/src/analytics/analytics-collector.js +5 -1
- package/{models/interface.js → src/analytics/analytics-environment-options.d.ts} +2 -2
- package/src/analytics/analytics-environment-options.js +20 -0
- package/src/analytics/analytics.d.ts +10 -23
- package/src/analytics/analytics.js +96 -182
- package/src/command-builder/architect-base-command-module.js +3 -5
- package/src/command-builder/architect-command-module.js +4 -6
- package/src/command-builder/command-module.d.ts +4 -1
- package/src/command-builder/command-module.js +9 -3
- package/src/command-builder/command-runner.js +9 -20
- package/src/command-builder/schematics-command-module.d.ts +18 -5
- package/src/command-builder/schematics-command-module.js +207 -29
- 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 +16 -14
- package/src/command-builder/utilities/json-help.js +26 -22
- package/{models → src/command-builder/utilities}/schematic-engine-host.d.ts +0 -0
- package/{models → src/command-builder/utilities}/schematic-engine-host.js +0 -0
- 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 +11 -1
- package/src/commands/add/cli.js +325 -6
- package/src/commands/analytics/cli.d.ts +5 -10
- package/src/commands/analytics/cli.js +15 -50
- 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/config/cli.d.ts +4 -1
- package/src/commands/config/cli.js +126 -4
- package/src/commands/doc/cli.js +5 -1
- package/src/commands/generate/cli.d.ts +4 -2
- package/src/commands/generate/cli.js +37 -21
- package/src/commands/new/cli.d.ts +5 -3
- package/src/commands/new/cli.js +36 -6
- package/src/commands/update/cli.d.ts +30 -5
- package/src/commands/update/cli.js +680 -9
- package/src/commands/update/schematic/index.js +5 -1
- package/src/commands/version/cli.js +18 -23
- package/src/utilities/color.js +5 -1
- package/src/utilities/config.d.ts +1 -0
- package/src/utilities/config.js +36 -2
- package/src/utilities/find-up.js +5 -1
- package/src/utilities/package-metadata.js +5 -1
- package/src/utilities/package-tree.js +5 -1
- package/src/utilities/project.js +5 -1
- package/src/utilities/prompt.js +5 -1
- package/models/command.d.ts +0 -29
- package/models/command.js +0 -50
- package/models/interface.d.ts +0 -19
- package/models/schematic-command.d.ts +0 -43
- package/models/schematic-command.js +0 -378
- package/src/commands/add/add-impl.d.ts +0 -22
- package/src/commands/add/add-impl.js +0 -331
- package/src/commands/analytics/long-description.md +0 -10
- package/src/commands/config/config-impl.d.ts +0 -17
- package/src/commands/config/config-impl.js +0 -151
- package/src/commands/generate/generate-impl.d.ts +0 -19
- package/src/commands/generate/generate-impl.js +0 -49
- package/src/commands/new/new-impl.d.ts +0 -18
- package/src/commands/new/new-impl.js +0 -38
- package/src/commands/update/update-impl.d.ts +0 -40
- package/src/commands/update/update-impl.js +0 -728
|
@@ -1,378 +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.SchematicCommand = exports.UnknownCollectionError = void 0;
|
|
30
|
-
const core_1 = require("@angular-devkit/core");
|
|
31
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
32
|
-
const tools_1 = require("@angular-devkit/schematics/tools");
|
|
33
|
-
const inquirer = __importStar(require("inquirer"));
|
|
34
|
-
const systemPath = __importStar(require("path"));
|
|
35
|
-
const analytics_1 = require("../src/analytics/analytics");
|
|
36
|
-
const json_schema_1 = require("../src/command-builder/utilities/json-schema");
|
|
37
|
-
const color_1 = require("../src/utilities/color");
|
|
38
|
-
const config_1 = require("../src/utilities/config");
|
|
39
|
-
const package_manager_1 = require("../src/utilities/package-manager");
|
|
40
|
-
const tty_1 = require("../src/utilities/tty");
|
|
41
|
-
const command_1 = require("./command");
|
|
42
|
-
const schematic_engine_host_1 = require("./schematic-engine-host");
|
|
43
|
-
class UnknownCollectionError extends Error {
|
|
44
|
-
constructor(collectionName) {
|
|
45
|
-
super(`Invalid collection (${collectionName}).`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.UnknownCollectionError = UnknownCollectionError;
|
|
49
|
-
class SchematicCommand extends command_1.Command {
|
|
50
|
-
constructor(context, commandName) {
|
|
51
|
-
super(context, commandName);
|
|
52
|
-
this.allowPrivateSchematics = false;
|
|
53
|
-
this.useReportAnalytics = false;
|
|
54
|
-
this.defaultCollectionName = '@schematics/angular';
|
|
55
|
-
this.collectionName = this.defaultCollectionName;
|
|
56
|
-
}
|
|
57
|
-
async initialize(options) {
|
|
58
|
-
this._workflow = await this.createWorkflow(options);
|
|
59
|
-
if (this.schematicName) {
|
|
60
|
-
// Set the options.
|
|
61
|
-
const collection = this.getCollection(this.collectionName);
|
|
62
|
-
const schematic = this.getSchematic(collection, this.schematicName, true);
|
|
63
|
-
const options = await (0, json_schema_1.parseJsonSchemaToOptions)(this._workflow.registry, schematic.description.schemaJson || {});
|
|
64
|
-
this.commandOptions.push(...options);
|
|
65
|
-
// Remove any user analytics from schematics that are NOT part of our safelist.
|
|
66
|
-
for (const o of this.commandOptions) {
|
|
67
|
-
if (o.userAnalytics && !(0, analytics_1.isPackageNameSafeForAnalytics)(this.collectionName)) {
|
|
68
|
-
o.userAnalytics = undefined;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
getEngine() {
|
|
74
|
-
return this._workflow.engine;
|
|
75
|
-
}
|
|
76
|
-
getCollection(collectionName) {
|
|
77
|
-
const engine = this.getEngine();
|
|
78
|
-
const collection = engine.createCollection(collectionName);
|
|
79
|
-
if (collection === null) {
|
|
80
|
-
throw new UnknownCollectionError(collectionName);
|
|
81
|
-
}
|
|
82
|
-
return collection;
|
|
83
|
-
}
|
|
84
|
-
getSchematic(collection, schematicName, allowPrivate) {
|
|
85
|
-
return collection.createSchematic(schematicName, allowPrivate);
|
|
86
|
-
}
|
|
87
|
-
/*
|
|
88
|
-
* Runtime hook to allow specifying customized workflow
|
|
89
|
-
*/
|
|
90
|
-
async createWorkflow(options) {
|
|
91
|
-
if (this._workflow) {
|
|
92
|
-
return this._workflow;
|
|
93
|
-
}
|
|
94
|
-
const { force, dryRun } = options;
|
|
95
|
-
const root = this.context.root;
|
|
96
|
-
const workflow = new tools_1.NodeWorkflow(root, {
|
|
97
|
-
force,
|
|
98
|
-
dryRun,
|
|
99
|
-
packageManager: await (0, package_manager_1.getPackageManager)(root),
|
|
100
|
-
packageRegistry: options.registry,
|
|
101
|
-
// A schema registry is required to allow customizing addUndefinedDefaults
|
|
102
|
-
registry: new core_1.schema.CoreSchemaRegistry(schematics_1.formats.standardFormats),
|
|
103
|
-
resolvePaths: this.workspace
|
|
104
|
-
? // Workspace
|
|
105
|
-
this.collectionName === this.defaultCollectionName
|
|
106
|
-
? // Favor __dirname for @schematics/angular to use the build-in version
|
|
107
|
-
[__dirname, process.cwd(), root]
|
|
108
|
-
: [process.cwd(), root, __dirname]
|
|
109
|
-
: // Global
|
|
110
|
-
[__dirname, process.cwd()],
|
|
111
|
-
schemaValidation: true,
|
|
112
|
-
optionTransforms: [
|
|
113
|
-
// Add configuration file defaults
|
|
114
|
-
async (schematic, current) => {
|
|
115
|
-
const projectName = typeof current.project === 'string'
|
|
116
|
-
? current.project
|
|
117
|
-
: getProjectName();
|
|
118
|
-
return {
|
|
119
|
-
...(await (0, config_1.getSchematicDefaults)(schematic.collection.name, schematic.name, projectName)),
|
|
120
|
-
...current,
|
|
121
|
-
};
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
engineHostCreator: (options) => new schematic_engine_host_1.SchematicEngineHost(options.resolvePaths),
|
|
125
|
-
});
|
|
126
|
-
const getProjectName = () => {
|
|
127
|
-
if (this.workspace) {
|
|
128
|
-
const projectNames = getProjectsByPath(this.workspace, process.cwd(), this.workspace.basePath);
|
|
129
|
-
if (projectNames.length === 1) {
|
|
130
|
-
return projectNames[0];
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
if (projectNames.length > 1) {
|
|
134
|
-
this.logger.warn(core_1.tags.oneLine `
|
|
135
|
-
Two or more projects are using identical roots.
|
|
136
|
-
Unable to determine project using current working directory.
|
|
137
|
-
Using default workspace project instead.
|
|
138
|
-
`);
|
|
139
|
-
}
|
|
140
|
-
const defaultProjectName = this.workspace.extensions['defaultProject'];
|
|
141
|
-
if (typeof defaultProjectName === 'string' && defaultProjectName) {
|
|
142
|
-
return defaultProjectName;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return undefined;
|
|
147
|
-
};
|
|
148
|
-
workflow.registry.addPostTransform(core_1.schema.transforms.addUndefinedDefaults);
|
|
149
|
-
workflow.registry.addSmartDefaultProvider('projectName', getProjectName);
|
|
150
|
-
workflow.registry.useXDeprecatedProvider((msg) => this.logger.warn(msg));
|
|
151
|
-
let shouldReportAnalytics = true;
|
|
152
|
-
workflow.engineHost.registerOptionsTransform(async (_, options) => {
|
|
153
|
-
if (shouldReportAnalytics) {
|
|
154
|
-
shouldReportAnalytics = false;
|
|
155
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
156
|
-
await this.reportAnalytics([this.commandName], options);
|
|
157
|
-
}
|
|
158
|
-
return options;
|
|
159
|
-
});
|
|
160
|
-
if (options.interactive !== false && (0, tty_1.isTTY)()) {
|
|
161
|
-
workflow.registry.usePromptProvider((definitions) => {
|
|
162
|
-
const questions = definitions
|
|
163
|
-
.filter((definition) => !options.defaults || definition.default === undefined)
|
|
164
|
-
.map((definition) => {
|
|
165
|
-
var _a;
|
|
166
|
-
const question = {
|
|
167
|
-
name: definition.id,
|
|
168
|
-
message: definition.message,
|
|
169
|
-
default: definition.default,
|
|
170
|
-
};
|
|
171
|
-
const validator = definition.validator;
|
|
172
|
-
if (validator) {
|
|
173
|
-
question.validate = (input) => validator(input);
|
|
174
|
-
// Filter allows transformation of the value prior to validation
|
|
175
|
-
question.filter = async (input) => {
|
|
176
|
-
for (const type of definition.propertyTypes) {
|
|
177
|
-
let value;
|
|
178
|
-
switch (type) {
|
|
179
|
-
case 'string':
|
|
180
|
-
value = String(input);
|
|
181
|
-
break;
|
|
182
|
-
case 'integer':
|
|
183
|
-
case 'number':
|
|
184
|
-
value = Number(input);
|
|
185
|
-
break;
|
|
186
|
-
default:
|
|
187
|
-
value = input;
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
// Can be a string if validation fails
|
|
191
|
-
const isValid = (await validator(value)) === true;
|
|
192
|
-
if (isValid) {
|
|
193
|
-
return value;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return input;
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
switch (definition.type) {
|
|
200
|
-
case 'confirmation':
|
|
201
|
-
question.type = 'confirm';
|
|
202
|
-
break;
|
|
203
|
-
case 'list':
|
|
204
|
-
question.type = definition.multiselect ? 'checkbox' : 'list';
|
|
205
|
-
question.choices = (_a = definition.items) === null || _a === void 0 ? void 0 : _a.map((item) => {
|
|
206
|
-
return typeof item == 'string'
|
|
207
|
-
? item
|
|
208
|
-
: {
|
|
209
|
-
name: item.label,
|
|
210
|
-
value: item.value,
|
|
211
|
-
};
|
|
212
|
-
});
|
|
213
|
-
break;
|
|
214
|
-
default:
|
|
215
|
-
question.type = definition.type;
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
return question;
|
|
219
|
-
});
|
|
220
|
-
return inquirer.prompt(questions);
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
return (this._workflow = workflow);
|
|
224
|
-
}
|
|
225
|
-
async getDefaultSchematicCollection() {
|
|
226
|
-
let workspace = await (0, config_1.getWorkspace)('local');
|
|
227
|
-
if (workspace) {
|
|
228
|
-
const project = (0, config_1.getProjectByCwd)(workspace);
|
|
229
|
-
if (project && workspace.getProjectCli(project)) {
|
|
230
|
-
const value = workspace.getProjectCli(project)['defaultCollection'];
|
|
231
|
-
if (typeof value == 'string') {
|
|
232
|
-
return value;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
if (workspace.getCli()) {
|
|
236
|
-
const value = workspace.getCli()['defaultCollection'];
|
|
237
|
-
if (typeof value == 'string') {
|
|
238
|
-
return value;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
workspace = await (0, config_1.getWorkspace)('global');
|
|
243
|
-
if (workspace && workspace.getCli()) {
|
|
244
|
-
const value = workspace.getCli()['defaultCollection'];
|
|
245
|
-
if (typeof value == 'string') {
|
|
246
|
-
return value;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
return this.defaultCollectionName;
|
|
250
|
-
}
|
|
251
|
-
async runSchematic(options) {
|
|
252
|
-
const { schematicOptions: input = {}, debug, dryRun } = options;
|
|
253
|
-
let { collectionName, schematicName } = options;
|
|
254
|
-
let nothingDone = true;
|
|
255
|
-
let loggingQueue = [];
|
|
256
|
-
let error = false;
|
|
257
|
-
const workflow = this._workflow;
|
|
258
|
-
// Get the option object from the schematic schema.
|
|
259
|
-
const schematic = this.getSchematic(this.getCollection(collectionName), schematicName, this.allowPrivateSchematics);
|
|
260
|
-
// Update the schematic and collection name in case they're not the same as the ones we
|
|
261
|
-
// received in our options, e.g. after alias resolution or extension.
|
|
262
|
-
collectionName = schematic.collection.description.name;
|
|
263
|
-
schematicName = schematic.description.name;
|
|
264
|
-
workflow.reporter.subscribe((event) => {
|
|
265
|
-
nothingDone = false;
|
|
266
|
-
// Strip leading slash to prevent confusion.
|
|
267
|
-
const eventPath = event.path.startsWith('/') ? event.path.substr(1) : event.path;
|
|
268
|
-
switch (event.kind) {
|
|
269
|
-
case 'error':
|
|
270
|
-
error = true;
|
|
271
|
-
const desc = event.description == 'alreadyExist' ? 'already exists' : 'does not exist.';
|
|
272
|
-
this.logger.warn(`ERROR! ${eventPath} ${desc}.`);
|
|
273
|
-
break;
|
|
274
|
-
case 'update':
|
|
275
|
-
loggingQueue.push(core_1.tags.oneLine `
|
|
276
|
-
${color_1.colors.cyan('UPDATE')} ${eventPath} (${event.content.length} bytes)
|
|
277
|
-
`);
|
|
278
|
-
break;
|
|
279
|
-
case 'create':
|
|
280
|
-
loggingQueue.push(core_1.tags.oneLine `
|
|
281
|
-
${color_1.colors.green('CREATE')} ${eventPath} (${event.content.length} bytes)
|
|
282
|
-
`);
|
|
283
|
-
break;
|
|
284
|
-
case 'delete':
|
|
285
|
-
loggingQueue.push(`${color_1.colors.yellow('DELETE')} ${eventPath}`);
|
|
286
|
-
break;
|
|
287
|
-
case 'rename':
|
|
288
|
-
const eventToPath = event.to.startsWith('/') ? event.to.substring(1) : event.to;
|
|
289
|
-
loggingQueue.push(`${color_1.colors.blue('RENAME')} ${eventPath} => ${eventToPath}`);
|
|
290
|
-
break;
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
workflow.lifeCycle.subscribe((event) => {
|
|
294
|
-
if (event.kind == 'end' || event.kind == 'post-tasks-start') {
|
|
295
|
-
if (!error) {
|
|
296
|
-
// Output the logging queue, no error happened.
|
|
297
|
-
loggingQueue.forEach((log) => this.logger.info(log));
|
|
298
|
-
}
|
|
299
|
-
loggingQueue = [];
|
|
300
|
-
error = false;
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
// Temporary compatibility check for NPM 7
|
|
304
|
-
if (collectionName === '@schematics/angular' && schematicName === 'ng-new') {
|
|
305
|
-
if (!input.skipInstall &&
|
|
306
|
-
(input.packageManager === undefined || input.packageManager === 'npm')) {
|
|
307
|
-
await (0, package_manager_1.ensureCompatibleNpm)(this.context.root);
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
return new Promise((resolve) => {
|
|
311
|
-
workflow
|
|
312
|
-
.execute({
|
|
313
|
-
collection: collectionName,
|
|
314
|
-
schematic: schematicName,
|
|
315
|
-
options: input,
|
|
316
|
-
debug: debug,
|
|
317
|
-
logger: this.logger,
|
|
318
|
-
allowPrivate: this.allowPrivateSchematics,
|
|
319
|
-
})
|
|
320
|
-
.subscribe({
|
|
321
|
-
error: (err) => {
|
|
322
|
-
// In case the workflow was not successful, show an appropriate error message.
|
|
323
|
-
if (err instanceof schematics_1.UnsuccessfulWorkflowExecution) {
|
|
324
|
-
// "See above" because we already printed the error.
|
|
325
|
-
this.logger.fatal('The Schematic workflow failed. See above.');
|
|
326
|
-
}
|
|
327
|
-
else if (debug) {
|
|
328
|
-
this.logger.fatal(`An error occurred:\n${err.message}\n${err.stack}`);
|
|
329
|
-
}
|
|
330
|
-
else {
|
|
331
|
-
this.logger.fatal(err.message);
|
|
332
|
-
}
|
|
333
|
-
resolve(1);
|
|
334
|
-
},
|
|
335
|
-
complete: () => {
|
|
336
|
-
const showNothingDone = !(options.showNothingDone === false);
|
|
337
|
-
if (nothingDone && showNothingDone) {
|
|
338
|
-
this.logger.info('Nothing to be done.');
|
|
339
|
-
}
|
|
340
|
-
if (dryRun) {
|
|
341
|
-
this.logger.warn(`\nNOTE: The "dryRun" flag means no changes were made.`);
|
|
342
|
-
}
|
|
343
|
-
resolve();
|
|
344
|
-
},
|
|
345
|
-
});
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
exports.SchematicCommand = SchematicCommand;
|
|
350
|
-
function getProjectsByPath(workspace, path, root) {
|
|
351
|
-
if (workspace.projects.size === 1) {
|
|
352
|
-
return Array.from(workspace.projects.keys());
|
|
353
|
-
}
|
|
354
|
-
const isInside = (base, potential) => {
|
|
355
|
-
const absoluteBase = systemPath.resolve(root, base);
|
|
356
|
-
const absolutePotential = systemPath.resolve(root, potential);
|
|
357
|
-
const relativePotential = systemPath.relative(absoluteBase, absolutePotential);
|
|
358
|
-
if (!relativePotential.startsWith('..') && !systemPath.isAbsolute(relativePotential)) {
|
|
359
|
-
return true;
|
|
360
|
-
}
|
|
361
|
-
return false;
|
|
362
|
-
};
|
|
363
|
-
const projects = Array.from(workspace.projects.entries())
|
|
364
|
-
.map(([name, project]) => [systemPath.resolve(root, project.root), name])
|
|
365
|
-
.filter((tuple) => isInside(tuple[0], path))
|
|
366
|
-
// Sort tuples by depth, with the deeper ones first. Since the first member is a path and
|
|
367
|
-
// we filtered all invalid paths, the longest will be the deepest (and in case of equality
|
|
368
|
-
// the sort is stable and the first declared project will win).
|
|
369
|
-
.sort((a, b) => b[0].length - a[0].length);
|
|
370
|
-
if (projects.length === 1) {
|
|
371
|
-
return [projects[0][1]];
|
|
372
|
-
}
|
|
373
|
-
else if (projects.length > 1) {
|
|
374
|
-
const firstPath = projects[0][0];
|
|
375
|
-
return projects.filter((v) => v[0] === firstPath).map((v) => v[1]);
|
|
376
|
-
}
|
|
377
|
-
return [];
|
|
378
|
-
}
|
|
@@ -1,22 +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 { SchematicCommand } from '../../../models/schematic-command';
|
|
9
|
-
import { Options } from '../../command-builder/command-module';
|
|
10
|
-
import { AddCommandArgs } from './cli';
|
|
11
|
-
declare type AddCommandOptions = Options<AddCommandArgs>;
|
|
12
|
-
export declare class AddCommandModule extends SchematicCommand<AddCommandOptions> {
|
|
13
|
-
readonly allowPrivateSchematics = true;
|
|
14
|
-
run(options: AddCommandOptions): Promise<number | void>;
|
|
15
|
-
private isProjectVersionValid;
|
|
16
|
-
reportAnalytics(paths: string[], options: AddCommandOptions, dimensions?: (boolean | number | string)[], metrics?: (boolean | number | string)[]): Promise<void>;
|
|
17
|
-
private isPackageInstalled;
|
|
18
|
-
private executeSchematic;
|
|
19
|
-
private findProjectVersion;
|
|
20
|
-
private hasMismatchedPeer;
|
|
21
|
-
}
|
|
22
|
-
export {};
|