@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
|
@@ -32,14 +32,13 @@ const schematics_1 = require("@angular-devkit/schematics");
|
|
|
32
32
|
const tools_1 = require("@angular-devkit/schematics/tools");
|
|
33
33
|
const inquirer = __importStar(require("inquirer"));
|
|
34
34
|
const systemPath = __importStar(require("path"));
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
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
41
|
const command_1 = require("./command");
|
|
42
|
-
const parser_1 = require("./parser");
|
|
43
42
|
const schematic_engine_host_1 = require("./schematic-engine-host");
|
|
44
43
|
class UnknownCollectionError extends Error {
|
|
45
44
|
constructor(collectionName) {
|
|
@@ -48,93 +47,29 @@ class UnknownCollectionError extends Error {
|
|
|
48
47
|
}
|
|
49
48
|
exports.UnknownCollectionError = UnknownCollectionError;
|
|
50
49
|
class SchematicCommand extends command_1.Command {
|
|
51
|
-
constructor(context,
|
|
52
|
-
super(context,
|
|
50
|
+
constructor(context, commandName) {
|
|
51
|
+
super(context, commandName);
|
|
53
52
|
this.allowPrivateSchematics = false;
|
|
54
53
|
this.useReportAnalytics = false;
|
|
55
54
|
this.defaultCollectionName = '@schematics/angular';
|
|
56
55
|
this.collectionName = this.defaultCollectionName;
|
|
57
56
|
}
|
|
58
57
|
async initialize(options) {
|
|
59
|
-
await this.createWorkflow(options);
|
|
58
|
+
this._workflow = await this.createWorkflow(options);
|
|
60
59
|
if (this.schematicName) {
|
|
61
60
|
// Set the options.
|
|
62
61
|
const collection = this.getCollection(this.collectionName);
|
|
63
62
|
const schematic = this.getSchematic(collection, this.schematicName, true);
|
|
64
63
|
const options = await (0, json_schema_1.parseJsonSchemaToOptions)(this._workflow.registry, schematic.description.schemaJson || {});
|
|
65
|
-
this.
|
|
66
|
-
this.description.options.push(...options.filter((x) => !x.hidden));
|
|
64
|
+
this.commandOptions.push(...options);
|
|
67
65
|
// Remove any user analytics from schematics that are NOT part of our safelist.
|
|
68
|
-
for (const o of this.
|
|
66
|
+
for (const o of this.commandOptions) {
|
|
69
67
|
if (o.userAnalytics && !(0, analytics_1.isPackageNameSafeForAnalytics)(this.collectionName)) {
|
|
70
68
|
o.userAnalytics = undefined;
|
|
71
69
|
}
|
|
72
70
|
}
|
|
73
71
|
}
|
|
74
72
|
}
|
|
75
|
-
async printHelp() {
|
|
76
|
-
await super.printHelp();
|
|
77
|
-
this.logger.info('');
|
|
78
|
-
const subCommandOption = this.description.options.filter((x) => x.subcommands)[0];
|
|
79
|
-
if (!subCommandOption || !subCommandOption.subcommands) {
|
|
80
|
-
return 0;
|
|
81
|
-
}
|
|
82
|
-
const schematicNames = Object.keys(subCommandOption.subcommands);
|
|
83
|
-
if (schematicNames.length > 1) {
|
|
84
|
-
this.logger.info('Available Schematics:');
|
|
85
|
-
const namesPerCollection = {};
|
|
86
|
-
schematicNames.forEach((name) => {
|
|
87
|
-
let [collectionName, schematicName] = name.split(/:/, 2);
|
|
88
|
-
if (!schematicName) {
|
|
89
|
-
schematicName = collectionName;
|
|
90
|
-
collectionName = this.collectionName;
|
|
91
|
-
}
|
|
92
|
-
if (!namesPerCollection[collectionName]) {
|
|
93
|
-
namesPerCollection[collectionName] = [];
|
|
94
|
-
}
|
|
95
|
-
namesPerCollection[collectionName].push(schematicName);
|
|
96
|
-
});
|
|
97
|
-
const defaultCollection = await this.getDefaultSchematicCollection();
|
|
98
|
-
Object.keys(namesPerCollection).forEach((collectionName) => {
|
|
99
|
-
const isDefault = defaultCollection == collectionName;
|
|
100
|
-
this.logger.info(` Collection "${collectionName}"${isDefault ? ' (default)' : ''}:`);
|
|
101
|
-
namesPerCollection[collectionName].forEach((schematicName) => {
|
|
102
|
-
this.logger.info(` ${schematicName}`);
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
return 0;
|
|
107
|
-
}
|
|
108
|
-
async printHelpUsage() {
|
|
109
|
-
const subCommandOption = this.description.options.filter((x) => x.subcommands)[0];
|
|
110
|
-
if (!subCommandOption || !subCommandOption.subcommands) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
const schematicNames = Object.keys(subCommandOption.subcommands);
|
|
114
|
-
if (schematicNames.length == 1) {
|
|
115
|
-
this.logger.info(this.description.description);
|
|
116
|
-
const opts = this.description.options.filter((x) => x.positional === undefined);
|
|
117
|
-
const [collectionName, schematicName] = schematicNames[0].split(/:/)[0];
|
|
118
|
-
// Display <collectionName:schematicName> if this is not the default collectionName,
|
|
119
|
-
// otherwise just show the schematicName.
|
|
120
|
-
const displayName = collectionName == (await this.getDefaultSchematicCollection())
|
|
121
|
-
? schematicName
|
|
122
|
-
: schematicNames[0];
|
|
123
|
-
const schematicOptions = subCommandOption.subcommands[schematicNames[0]].options;
|
|
124
|
-
const schematicArgs = schematicOptions.filter((x) => x.positional !== undefined);
|
|
125
|
-
const argDisplay = schematicArgs.length > 0
|
|
126
|
-
? ' ' + schematicArgs.map((a) => `<${core_1.strings.dasherize(a.name)}>`).join(' ')
|
|
127
|
-
: '';
|
|
128
|
-
this.logger.info(core_1.tags.oneLine `
|
|
129
|
-
usage: ng ${this.description.name} ${displayName}${argDisplay}
|
|
130
|
-
${opts.length > 0 ? `[options]` : ``}
|
|
131
|
-
`);
|
|
132
|
-
this.logger.info('');
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
await super.printHelpUsage();
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
73
|
getEngine() {
|
|
139
74
|
return this._workflow.engine;
|
|
140
75
|
}
|
|
@@ -149,18 +84,6 @@ class SchematicCommand extends command_1.Command {
|
|
|
149
84
|
getSchematic(collection, schematicName, allowPrivate) {
|
|
150
85
|
return collection.createSchematic(schematicName, allowPrivate);
|
|
151
86
|
}
|
|
152
|
-
setPathOptions(options, workingDir) {
|
|
153
|
-
if (workingDir === '') {
|
|
154
|
-
return {};
|
|
155
|
-
}
|
|
156
|
-
return options
|
|
157
|
-
.filter((o) => o.format === 'path')
|
|
158
|
-
.map((o) => o.name)
|
|
159
|
-
.reduce((acc, curr) => {
|
|
160
|
-
acc[curr] = workingDir;
|
|
161
|
-
return acc;
|
|
162
|
-
}, {});
|
|
163
|
-
}
|
|
164
87
|
/*
|
|
165
88
|
* Runtime hook to allow specifying customized workflow
|
|
166
89
|
*/
|
|
@@ -174,7 +97,7 @@ class SchematicCommand extends command_1.Command {
|
|
|
174
97
|
force,
|
|
175
98
|
dryRun,
|
|
176
99
|
packageManager: await (0, package_manager_1.getPackageManager)(root),
|
|
177
|
-
packageRegistry: options.
|
|
100
|
+
packageRegistry: options.registry,
|
|
178
101
|
// A schema registry is required to allow customizing addUndefinedDefaults
|
|
179
102
|
registry: new core_1.schema.CoreSchemaRegistry(schematics_1.formats.standardFormats),
|
|
180
103
|
resolvePaths: this.workspace
|
|
@@ -229,7 +152,8 @@ class SchematicCommand extends command_1.Command {
|
|
|
229
152
|
workflow.engineHost.registerOptionsTransform(async (_, options) => {
|
|
230
153
|
if (shouldReportAnalytics) {
|
|
231
154
|
shouldReportAnalytics = false;
|
|
232
|
-
|
|
155
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
156
|
+
await this.reportAnalytics([this.commandName], options);
|
|
233
157
|
}
|
|
234
158
|
return options;
|
|
235
159
|
});
|
|
@@ -325,43 +249,18 @@ class SchematicCommand extends command_1.Command {
|
|
|
325
249
|
return this.defaultCollectionName;
|
|
326
250
|
}
|
|
327
251
|
async runSchematic(options) {
|
|
328
|
-
const { schematicOptions, debug, dryRun } = options;
|
|
252
|
+
const { schematicOptions: input = {}, debug, dryRun } = options;
|
|
329
253
|
let { collectionName, schematicName } = options;
|
|
330
254
|
let nothingDone = true;
|
|
331
255
|
let loggingQueue = [];
|
|
332
256
|
let error = false;
|
|
333
257
|
const workflow = this._workflow;
|
|
334
|
-
const workingDir = (0, core_1.normalize)(systemPath.relative(this.context.root, process.cwd()));
|
|
335
258
|
// Get the option object from the schematic schema.
|
|
336
259
|
const schematic = this.getSchematic(this.getCollection(collectionName), schematicName, this.allowPrivateSchematics);
|
|
337
260
|
// Update the schematic and collection name in case they're not the same as the ones we
|
|
338
261
|
// received in our options, e.g. after alias resolution or extension.
|
|
339
262
|
collectionName = schematic.collection.description.name;
|
|
340
263
|
schematicName = schematic.description.name;
|
|
341
|
-
// Set the options of format "path".
|
|
342
|
-
let o = null;
|
|
343
|
-
let args;
|
|
344
|
-
if (!schematic.description.schemaJson) {
|
|
345
|
-
args = await this.parseFreeFormArguments(schematicOptions || []);
|
|
346
|
-
}
|
|
347
|
-
else {
|
|
348
|
-
o = await (0, json_schema_1.parseJsonSchemaToOptions)(workflow.registry, schematic.description.schemaJson);
|
|
349
|
-
args = await this.parseArguments(schematicOptions || [], o);
|
|
350
|
-
}
|
|
351
|
-
const allowAdditionalProperties = typeof schematic.description.schemaJson === 'object' &&
|
|
352
|
-
schematic.description.schemaJson.additionalProperties;
|
|
353
|
-
if (args['--'] && !allowAdditionalProperties) {
|
|
354
|
-
args['--'].forEach((additional) => {
|
|
355
|
-
this.logger.fatal(`Unknown option: '${additional.split(/=/)[0]}'`);
|
|
356
|
-
});
|
|
357
|
-
return 1;
|
|
358
|
-
}
|
|
359
|
-
const pathOptions = o ? this.setPathOptions(o, workingDir) : {};
|
|
360
|
-
const input = {
|
|
361
|
-
...pathOptions,
|
|
362
|
-
...args,
|
|
363
|
-
...options.additionalOptions,
|
|
364
|
-
};
|
|
365
264
|
workflow.reporter.subscribe((event) => {
|
|
366
265
|
nothingDone = false;
|
|
367
266
|
// Strip leading slash to prevent confusion.
|
|
@@ -386,7 +285,7 @@ class SchematicCommand extends command_1.Command {
|
|
|
386
285
|
loggingQueue.push(`${color_1.colors.yellow('DELETE')} ${eventPath}`);
|
|
387
286
|
break;
|
|
388
287
|
case 'rename':
|
|
389
|
-
const eventToPath = event.to.startsWith('/') ? event.to.
|
|
288
|
+
const eventToPath = event.to.startsWith('/') ? event.to.substring(1) : event.to;
|
|
390
289
|
loggingQueue.push(`${color_1.colors.blue('RENAME')} ${eventPath} => ${eventToPath}`);
|
|
391
290
|
break;
|
|
392
291
|
}
|
|
@@ -446,12 +345,6 @@ class SchematicCommand extends command_1.Command {
|
|
|
446
345
|
});
|
|
447
346
|
});
|
|
448
347
|
}
|
|
449
|
-
async parseFreeFormArguments(schematicOptions) {
|
|
450
|
-
return (0, parser_1.parseFreeFormArguments)(schematicOptions);
|
|
451
|
-
}
|
|
452
|
-
async parseArguments(schematicOptions, options) {
|
|
453
|
-
return (0, parser_1.parseArguments)(schematicOptions, options, this.logger);
|
|
454
|
-
}
|
|
455
348
|
}
|
|
456
349
|
exports.SchematicCommand = SchematicCommand;
|
|
457
350
|
function getProjectsByPath(workspace, path, root) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/cli",
|
|
3
|
-
"version": "14.0.0-next.
|
|
3
|
+
"version": "14.0.0-next.5",
|
|
4
4
|
"description": "CLI tool for Angular",
|
|
5
5
|
"main": "lib/cli/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/angular/angular-cli",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@angular-devkit/architect": "0.1400.0-next.
|
|
32
|
-
"@angular-devkit/core": "14.0.0-next.
|
|
33
|
-
"@angular-devkit/schematics": "14.0.0-next.
|
|
34
|
-
"@schematics/angular": "14.0.0-next.
|
|
31
|
+
"@angular-devkit/architect": "0.1400.0-next.5",
|
|
32
|
+
"@angular-devkit/core": "14.0.0-next.5",
|
|
33
|
+
"@angular-devkit/schematics": "14.0.0-next.5",
|
|
34
|
+
"@schematics/angular": "14.0.0-next.5",
|
|
35
35
|
"@yarnpkg/lockfile": "1.1.0",
|
|
36
36
|
"ansi-colors": "4.1.1",
|
|
37
37
|
"debug": "4.3.3",
|
|
38
38
|
"ini": "2.0.0",
|
|
39
|
-
"inquirer": "8.2.
|
|
39
|
+
"inquirer": "8.2.1",
|
|
40
40
|
"jsonc-parser": "3.0.0",
|
|
41
41
|
"npm-package-arg": "9.0.0",
|
|
42
42
|
"npm-pick-manifest": "7.0.0",
|
|
@@ -46,21 +46,22 @@
|
|
|
46
46
|
"resolve": "1.22.0",
|
|
47
47
|
"semver": "7.3.5",
|
|
48
48
|
"symbol-observable": "4.0.0",
|
|
49
|
-
"uuid": "8.3.2"
|
|
49
|
+
"uuid": "8.3.2",
|
|
50
|
+
"yargs": "17.3.1"
|
|
50
51
|
},
|
|
51
52
|
"ng-update": {
|
|
52
53
|
"migrations": "@schematics/angular/migrations/migration-collection.json",
|
|
53
54
|
"packageGroup": {
|
|
54
|
-
"@angular/cli": "14.0.0-next.
|
|
55
|
-
"@angular-devkit/architect": "0.1400.0-next.
|
|
56
|
-
"@angular-devkit/build-angular": "14.0.0-next.
|
|
57
|
-
"@angular-devkit/build-webpack": "0.1400.0-next.
|
|
58
|
-
"@angular-devkit/core": "14.0.0-next.
|
|
59
|
-
"@angular-devkit/schematics": "14.0.0-next.
|
|
55
|
+
"@angular/cli": "14.0.0-next.5",
|
|
56
|
+
"@angular-devkit/architect": "0.1400.0-next.5",
|
|
57
|
+
"@angular-devkit/build-angular": "14.0.0-next.5",
|
|
58
|
+
"@angular-devkit/build-webpack": "0.1400.0-next.5",
|
|
59
|
+
"@angular-devkit/core": "14.0.0-next.5",
|
|
60
|
+
"@angular-devkit/schematics": "14.0.0-next.5"
|
|
60
61
|
}
|
|
61
62
|
},
|
|
62
63
|
"engines": {
|
|
63
|
-
"node": "^
|
|
64
|
+
"node": "^14.15.0 || >=16.10.0",
|
|
64
65
|
"npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
|
|
65
66
|
"yarn": ">= 1.13.0"
|
|
66
67
|
}
|
|
File without changes
|
|
@@ -36,7 +36,7 @@ const debug_1 = __importDefault(require("debug"));
|
|
|
36
36
|
const https = __importStar(require("https"));
|
|
37
37
|
const os = __importStar(require("os"));
|
|
38
38
|
const querystring = __importStar(require("querystring"));
|
|
39
|
-
const version_1 = require("
|
|
39
|
+
const version_1 = require("../utilities/version");
|
|
40
40
|
/**
|
|
41
41
|
* See: https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide
|
|
42
42
|
*/
|
|
@@ -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.io/license
|
|
7
7
|
*/
|
|
8
|
+
import { analytics } from '@angular-devkit/core';
|
|
8
9
|
import { AnalyticsCollector } from './analytics-collector';
|
|
9
10
|
export declare const AnalyticsProperties: {
|
|
10
11
|
AngularCliProd: string;
|
|
@@ -56,3 +57,4 @@ export declare function getWorkspaceAnalytics(): Promise<AnalyticsCollector | un
|
|
|
56
57
|
* or undefined if no sharing.
|
|
57
58
|
*/
|
|
58
59
|
export declare function getSharedAnalytics(): Promise<AnalyticsCollector | undefined>;
|
|
60
|
+
export declare function createAnalytics(workspace: boolean, skipPrompt?: boolean): Promise<analytics.Analytics>;
|
|
@@ -29,15 +29,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.getSharedAnalytics = exports.getWorkspaceAnalytics = exports.hasWorkspaceAnalyticsConfiguration = exports.getGlobalAnalytics = exports.hasGlobalAnalyticsConfiguration = exports.promptProjectAnalytics = exports.promptGlobalAnalytics = exports.setAnalyticsConfig = exports.isPackageNameSafeForAnalytics = exports.analyticsPackageSafelist = exports.AnalyticsProperties = void 0;
|
|
32
|
+
exports.createAnalytics = exports.getSharedAnalytics = exports.getWorkspaceAnalytics = exports.hasWorkspaceAnalyticsConfiguration = exports.getGlobalAnalytics = exports.hasGlobalAnalyticsConfiguration = exports.promptProjectAnalytics = exports.promptGlobalAnalytics = exports.setAnalyticsConfig = exports.isPackageNameSafeForAnalytics = exports.analyticsPackageSafelist = exports.AnalyticsProperties = void 0;
|
|
33
33
|
const core_1 = require("@angular-devkit/core");
|
|
34
34
|
const debug_1 = __importDefault(require("debug"));
|
|
35
35
|
const inquirer = __importStar(require("inquirer"));
|
|
36
36
|
const uuid_1 = require("uuid");
|
|
37
|
-
const version_1 = require("../models/version");
|
|
38
37
|
const color_1 = require("../utilities/color");
|
|
39
38
|
const config_1 = require("../utilities/config");
|
|
40
39
|
const tty_1 = require("../utilities/tty");
|
|
40
|
+
const version_1 = require("../utilities/version");
|
|
41
41
|
const analytics_collector_1 = require("./analytics-collector");
|
|
42
42
|
/* eslint-disable no-console */
|
|
43
43
|
const analyticsDebug = (0, debug_1.default)('ng:analytics'); // Generate analytics, including settings and users.
|
|
@@ -356,3 +356,34 @@ async function getSharedAnalytics() {
|
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
exports.getSharedAnalytics = getSharedAnalytics;
|
|
359
|
+
async function createAnalytics(workspace, skipPrompt = false) {
|
|
360
|
+
let config = await getGlobalAnalytics();
|
|
361
|
+
// If in workspace and global analytics is enabled, defer to workspace level
|
|
362
|
+
if (workspace && config) {
|
|
363
|
+
const skipAnalytics = skipPrompt ||
|
|
364
|
+
(process.env['NG_CLI_ANALYTICS'] &&
|
|
365
|
+
(process.env['NG_CLI_ANALYTICS'].toLowerCase() === 'false' ||
|
|
366
|
+
process.env['NG_CLI_ANALYTICS'] === '0'));
|
|
367
|
+
// TODO: This should honor the `no-interactive` option.
|
|
368
|
+
// It is currently not an `ng` option but rather only an option for specific commands.
|
|
369
|
+
// The concept of `ng`-wide options are needed to cleanly handle this.
|
|
370
|
+
if (!skipAnalytics && !(await hasWorkspaceAnalyticsConfiguration())) {
|
|
371
|
+
await promptProjectAnalytics();
|
|
372
|
+
}
|
|
373
|
+
config = await getWorkspaceAnalytics();
|
|
374
|
+
}
|
|
375
|
+
const maybeSharedAnalytics = await getSharedAnalytics();
|
|
376
|
+
if (config && maybeSharedAnalytics) {
|
|
377
|
+
return new core_1.analytics.MultiAnalytics([config, maybeSharedAnalytics]);
|
|
378
|
+
}
|
|
379
|
+
else if (config) {
|
|
380
|
+
return config;
|
|
381
|
+
}
|
|
382
|
+
else if (maybeSharedAnalytics) {
|
|
383
|
+
return maybeSharedAnalytics;
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
return new core_1.analytics.NoopAnalytics();
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
exports.createAnalytics = createAnalytics;
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { CommandModule, CommandModuleImplementation, CommandScope, OtherOptions } from './command-module';
|
|
11
|
+
import { Option } from './utilities/json-schema';
|
|
12
|
+
export declare abstract class ArchitectBaseCommandModule<T> extends CommandModule<T> implements CommandModuleImplementation<T> {
|
|
13
|
+
static scope: CommandScope;
|
|
14
|
+
protected shouldReportAnalytics: boolean;
|
|
15
|
+
protected readonly missingErrorTarget: string | undefined;
|
|
16
|
+
protected runSingleTarget(target: Target, options: OtherOptions): Promise<number>;
|
|
17
|
+
private _architectHost;
|
|
18
|
+
protected getArchitectHost(): WorkspaceNodeModulesArchitectHost;
|
|
19
|
+
private _architect;
|
|
20
|
+
protected getArchitect(): Architect;
|
|
21
|
+
protected getArchitectTargetOptions(target: Target): Promise<Option[]>;
|
|
22
|
+
private warnOnMissingNodeModules;
|
|
23
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
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.ArchitectBaseCommandModule = void 0;
|
|
11
|
+
const architect_1 = require("@angular-devkit/architect");
|
|
12
|
+
const node_1 = require("@angular-devkit/architect/node");
|
|
13
|
+
const core_1 = require("@angular-devkit/core");
|
|
14
|
+
const fs_1 = require("fs");
|
|
15
|
+
const path_1 = require("path");
|
|
16
|
+
const analytics_1 = require("../analytics/analytics");
|
|
17
|
+
const package_manager_1 = require("../utilities/package-manager");
|
|
18
|
+
const command_module_1 = require("./command-module");
|
|
19
|
+
const json_schema_1 = require("./utilities/json-schema");
|
|
20
|
+
class ArchitectBaseCommandModule extends command_module_1.CommandModule {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this.shouldReportAnalytics = false;
|
|
24
|
+
}
|
|
25
|
+
async runSingleTarget(target, options) {
|
|
26
|
+
var _a;
|
|
27
|
+
const architectHost = await this.getArchitectHost();
|
|
28
|
+
let builderName;
|
|
29
|
+
try {
|
|
30
|
+
builderName = await architectHost.getBuilderNameForTarget(target);
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
throw new command_module_1.CommandModuleError((_a = this.missingErrorTarget) !== null && _a !== void 0 ? _a : e.message);
|
|
34
|
+
}
|
|
35
|
+
await this.reportAnalytics({
|
|
36
|
+
...(await architectHost.getOptionsForTarget(target)),
|
|
37
|
+
...options,
|
|
38
|
+
});
|
|
39
|
+
const { logger } = this.context;
|
|
40
|
+
const run = await this.getArchitect().scheduleTarget(target, options, {
|
|
41
|
+
logger,
|
|
42
|
+
analytics: (0, analytics_1.isPackageNameSafeForAnalytics)(builderName) ? await this.getAnalytics() : undefined,
|
|
43
|
+
});
|
|
44
|
+
const { error, success } = await run.output.toPromise();
|
|
45
|
+
await run.stop();
|
|
46
|
+
if (error) {
|
|
47
|
+
logger.error(error);
|
|
48
|
+
}
|
|
49
|
+
return success ? 0 : 1;
|
|
50
|
+
}
|
|
51
|
+
getArchitectHost() {
|
|
52
|
+
if (this._architectHost) {
|
|
53
|
+
return this._architectHost;
|
|
54
|
+
}
|
|
55
|
+
const workspace = this.getWorkspaceOrThrow();
|
|
56
|
+
return (this._architectHost = new node_1.WorkspaceNodeModulesArchitectHost(workspace, workspace.basePath));
|
|
57
|
+
}
|
|
58
|
+
getArchitect() {
|
|
59
|
+
if (this._architect) {
|
|
60
|
+
return this._architect;
|
|
61
|
+
}
|
|
62
|
+
const registry = new core_1.json.schema.CoreSchemaRegistry();
|
|
63
|
+
registry.addPostTransform(core_1.json.schema.transforms.addUndefinedDefaults);
|
|
64
|
+
registry.useXDeprecatedProvider((msg) => this.context.logger.warn(msg));
|
|
65
|
+
const architectHost = this.getArchitectHost();
|
|
66
|
+
return (this._architect = new architect_1.Architect(architectHost, registry));
|
|
67
|
+
}
|
|
68
|
+
async getArchitectTargetOptions(target) {
|
|
69
|
+
const architectHost = this.getArchitectHost();
|
|
70
|
+
const builderConf = await architectHost.getBuilderNameForTarget(target);
|
|
71
|
+
let builderDesc;
|
|
72
|
+
try {
|
|
73
|
+
builderDesc = await architectHost.resolveBuilder(builderConf);
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
if (e.code === 'MODULE_NOT_FOUND') {
|
|
77
|
+
await this.warnOnMissingNodeModules();
|
|
78
|
+
throw new command_module_1.CommandModuleError(`Could not find the '${builderConf}' builder's node package.`);
|
|
79
|
+
}
|
|
80
|
+
throw e;
|
|
81
|
+
}
|
|
82
|
+
return (0, json_schema_1.parseJsonSchemaToOptions)(new core_1.json.schema.CoreSchemaRegistry(), builderDesc.optionSchema, true);
|
|
83
|
+
}
|
|
84
|
+
async warnOnMissingNodeModules() {
|
|
85
|
+
var _a;
|
|
86
|
+
const basePath = (_a = this.context.workspace) === null || _a === void 0 ? void 0 : _a.basePath;
|
|
87
|
+
if (!basePath) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
// Check for a `node_modules` directory (npm, yarn non-PnP, etc.)
|
|
91
|
+
if ((0, fs_1.existsSync)((0, path_1.resolve)(basePath, 'node_modules'))) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
// Check for yarn PnP files
|
|
95
|
+
if ((0, fs_1.existsSync)((0, path_1.resolve)(basePath, '.pnp.js')) ||
|
|
96
|
+
(0, fs_1.existsSync)((0, path_1.resolve)(basePath, '.pnp.cjs')) ||
|
|
97
|
+
(0, fs_1.existsSync)((0, path_1.resolve)(basePath, '.pnp.mjs'))) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const packageManager = await (0, package_manager_1.getPackageManager)(basePath);
|
|
101
|
+
this.context.logger.warn(`Node packages may not be installed. Try installing with '${packageManager} install'.`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.ArchitectBaseCommandModule = ArchitectBaseCommandModule;
|
|
105
|
+
ArchitectBaseCommandModule.scope = command_module_1.CommandScope.In;
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { Argv } from 'yargs';
|
|
9
|
+
import { ArchitectBaseCommandModule } from './architect-base-command-module';
|
|
10
|
+
import { CommandModuleImplementation, Options, OtherOptions } from './command-module';
|
|
11
|
+
export interface ArchitectCommandArgs {
|
|
12
|
+
configuration?: string;
|
|
13
|
+
project?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare abstract class ArchitectCommandModule extends ArchitectBaseCommandModule<ArchitectCommandArgs> implements CommandModuleImplementation<ArchitectCommandArgs> {
|
|
16
|
+
abstract readonly multiTarget: boolean;
|
|
17
|
+
builder(argv: Argv): Promise<Argv<ArchitectCommandArgs>>;
|
|
18
|
+
run(options: Options<ArchitectCommandArgs> & OtherOptions): Promise<number | void>;
|
|
19
|
+
private getArchitectProject;
|
|
20
|
+
private getArchitectTarget;
|
|
21
|
+
private getProjectNamesByTarget;
|
|
22
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
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.ArchitectCommandModule = void 0;
|
|
11
|
+
const architect_base_command_module_1 = require("./architect-base-command-module");
|
|
12
|
+
const command_module_1 = require("./command-module");
|
|
13
|
+
class ArchitectCommandModule extends architect_base_command_module_1.ArchitectBaseCommandModule {
|
|
14
|
+
async builder(argv) {
|
|
15
|
+
const localYargs = argv
|
|
16
|
+
.positional('project', {
|
|
17
|
+
describe: 'The name of the project to build. Can be an application or a library.',
|
|
18
|
+
type: 'string',
|
|
19
|
+
})
|
|
20
|
+
.option('configuration', {
|
|
21
|
+
describe: `One or more named builder configurations as a comma-separated ` +
|
|
22
|
+
`list as specified in the "configurations" section in angular.json.\n` +
|
|
23
|
+
`The builder uses the named configurations to run the given target.\n` +
|
|
24
|
+
`For more information, see https://angular.io/guide/workspace-config#alternate-build-configurations.`,
|
|
25
|
+
alias: 'c',
|
|
26
|
+
type: 'string',
|
|
27
|
+
})
|
|
28
|
+
.strict();
|
|
29
|
+
const project = this.getArchitectProject();
|
|
30
|
+
if (!project) {
|
|
31
|
+
return localYargs;
|
|
32
|
+
}
|
|
33
|
+
const target = this.getArchitectTarget();
|
|
34
|
+
const schemaOptions = await this.getArchitectTargetOptions({
|
|
35
|
+
project,
|
|
36
|
+
target,
|
|
37
|
+
});
|
|
38
|
+
return this.addSchemaOptionsToCommand(localYargs, schemaOptions);
|
|
39
|
+
}
|
|
40
|
+
async run(options) {
|
|
41
|
+
var _a;
|
|
42
|
+
const target = this.getArchitectTarget();
|
|
43
|
+
const { configuration = '', project, ...architectOptions } = options;
|
|
44
|
+
if (!project) {
|
|
45
|
+
// This runs each target sequentially.
|
|
46
|
+
// Running them in parallel would jumble the log messages.
|
|
47
|
+
let result = 0;
|
|
48
|
+
const projectNames = this.getProjectNamesByTarget(target);
|
|
49
|
+
if (!projectNames) {
|
|
50
|
+
throw new command_module_1.CommandModuleError((_a = this.missingErrorTarget) !== null && _a !== void 0 ? _a : 'Cannot determine project or target for command.');
|
|
51
|
+
}
|
|
52
|
+
for (const project of projectNames) {
|
|
53
|
+
result |= await this.runSingleTarget({ configuration, target, project }, architectOptions);
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return await this.runSingleTarget({ configuration, target, project }, architectOptions);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
getArchitectProject() {
|
|
62
|
+
const workspace = this.context.workspace;
|
|
63
|
+
if (!workspace) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
const [, projectName] = this.context.args.positional;
|
|
67
|
+
if (projectName) {
|
|
68
|
+
if (!workspace.projects.has(projectName)) {
|
|
69
|
+
throw new command_module_1.CommandModuleError(`Project '${projectName}' does not exist.`);
|
|
70
|
+
}
|
|
71
|
+
return projectName;
|
|
72
|
+
}
|
|
73
|
+
const target = this.getArchitectTarget();
|
|
74
|
+
const projectFromTarget = this.getProjectNamesByTarget(target);
|
|
75
|
+
return (projectFromTarget === null || projectFromTarget === void 0 ? void 0 : projectFromTarget.length) ? projectFromTarget[0] : undefined;
|
|
76
|
+
}
|
|
77
|
+
getArchitectTarget() {
|
|
78
|
+
return this.commandName;
|
|
79
|
+
}
|
|
80
|
+
getProjectNamesByTarget(target) {
|
|
81
|
+
const workspace = this.getWorkspaceOrThrow();
|
|
82
|
+
const allProjectsForTargetName = [];
|
|
83
|
+
for (const [name, project] of workspace.projects) {
|
|
84
|
+
if (project.targets.has(target)) {
|
|
85
|
+
allProjectsForTargetName.push(name);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (allProjectsForTargetName.length === 0) {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
if (this.multiTarget) {
|
|
92
|
+
// For multi target commands, we always list all projects that have the target.
|
|
93
|
+
return allProjectsForTargetName;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
// For single target commands, we try the default project first,
|
|
97
|
+
// then the full list if it has a single project, then error out.
|
|
98
|
+
const maybeDefaultProject = workspace.extensions['defaultProject'];
|
|
99
|
+
if (typeof maybeDefaultProject === 'string' &&
|
|
100
|
+
allProjectsForTargetName.includes(maybeDefaultProject)) {
|
|
101
|
+
return [maybeDefaultProject];
|
|
102
|
+
}
|
|
103
|
+
if (allProjectsForTargetName.length === 1) {
|
|
104
|
+
return allProjectsForTargetName;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.ArchitectCommandModule = ArchitectCommandModule;
|