@angular/cli 18.1.0-next.2 → 18.1.0-rc.0

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.
@@ -22,11 +22,39 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
22
22
  }) : function(o, v) {
23
23
  o["default"] = v;
24
24
  });
25
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
26
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
27
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
28
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
29
- return c > 3 && r && Object.defineProperty(target, key, r), r;
25
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
26
+ var useValue = arguments.length > 2;
27
+ for (var i = 0; i < initializers.length; i++) {
28
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
29
+ }
30
+ return useValue ? value : void 0;
31
+ };
32
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
33
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
34
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
35
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
36
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
37
+ var _, done = false;
38
+ for (var i = decorators.length - 1; i >= 0; i--) {
39
+ var context = {};
40
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
41
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
42
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
43
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
44
+ if (kind === "accessor") {
45
+ if (result === void 0) continue;
46
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
47
+ if (_ = accept(result.get)) descriptor.get = _;
48
+ if (_ = accept(result.set)) descriptor.set = _;
49
+ if (_ = accept(result.init)) initializers.unshift(_);
50
+ }
51
+ else if (_ = accept(result)) {
52
+ if (kind === "field") initializers.unshift(_);
53
+ else descriptor[key] = _;
54
+ }
55
+ }
56
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
57
+ done = true;
30
58
  };
31
59
  var __importStar = (this && this.__importStar) || function (mod) {
32
60
  if (mod && mod.__esModule) return mod;
@@ -35,9 +63,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
35
63
  __setModuleDefault(result, mod);
36
64
  return result;
37
65
  };
38
- var __metadata = (this && this.__metadata) || function (k, v) {
39
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
40
- };
41
66
  Object.defineProperty(exports, "__esModule", { value: true });
42
67
  exports.SchematicsCommandModule = exports.DEFAULT_SCHEMATICS_COLLECTION = void 0;
43
68
  const core_1 = require("@angular-devkit/core");
@@ -55,300 +80,299 @@ const json_schema_1 = require("./utilities/json-schema");
55
80
  const schematic_engine_host_1 = require("./utilities/schematic-engine-host");
56
81
  const schematic_workflow_1 = require("./utilities/schematic-workflow");
57
82
  exports.DEFAULT_SCHEMATICS_COLLECTION = '@schematics/angular';
58
- class SchematicsCommandModule extends command_module_1.CommandModule {
59
- scope = command_module_1.CommandScope.In;
60
- allowPrivateSchematics = false;
61
- async builder(argv) {
62
- return argv
63
- .option('interactive', {
64
- describe: 'Enable interactive input prompts.',
65
- type: 'boolean',
66
- default: true,
67
- })
68
- .option('dry-run', {
69
- describe: 'Run through and reports activity without writing out results.',
70
- type: 'boolean',
71
- alias: ['d'],
72
- default: false,
73
- })
74
- .option('defaults', {
75
- describe: 'Disable interactive input prompts for options with a default.',
76
- type: 'boolean',
77
- default: false,
78
- })
79
- .option('force', {
80
- describe: 'Force overwriting of existing files.',
81
- type: 'boolean',
82
- default: false,
83
- })
84
- .strict();
85
- }
86
- /** Get schematic schema options.*/
87
- async getSchematicOptions(collection, schematicName, workflow) {
88
- const schematic = collection.createSchematic(schematicName, true);
89
- const { schemaJson } = schematic.description;
90
- if (!schemaJson) {
91
- return [];
83
+ let SchematicsCommandModule = (() => {
84
+ let _classSuper = command_module_1.CommandModule;
85
+ let _instanceExtraInitializers = [];
86
+ let _getOrCreateWorkflowForBuilder_decorators;
87
+ let _getOrCreateWorkflowForExecution_decorators;
88
+ let _getSchematicCollections_decorators;
89
+ return class SchematicsCommandModule extends _classSuper {
90
+ static {
91
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
92
+ _getOrCreateWorkflowForBuilder_decorators = [memoize_1.memoize];
93
+ _getOrCreateWorkflowForExecution_decorators = [memoize_1.memoize];
94
+ _getSchematicCollections_decorators = [memoize_1.memoize];
95
+ __esDecorate(this, null, _getOrCreateWorkflowForBuilder_decorators, { kind: "method", name: "getOrCreateWorkflowForBuilder", static: false, private: false, access: { has: obj => "getOrCreateWorkflowForBuilder" in obj, get: obj => obj.getOrCreateWorkflowForBuilder }, metadata: _metadata }, null, _instanceExtraInitializers);
96
+ __esDecorate(this, null, _getOrCreateWorkflowForExecution_decorators, { kind: "method", name: "getOrCreateWorkflowForExecution", static: false, private: false, access: { has: obj => "getOrCreateWorkflowForExecution" in obj, get: obj => obj.getOrCreateWorkflowForExecution }, metadata: _metadata }, null, _instanceExtraInitializers);
97
+ __esDecorate(this, null, _getSchematicCollections_decorators, { kind: "method", name: "getSchematicCollections", static: false, private: false, access: { has: obj => "getSchematicCollections" in obj, get: obj => obj.getSchematicCollections }, metadata: _metadata }, null, _instanceExtraInitializers);
98
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
92
99
  }
93
- return (0, json_schema_1.parseJsonSchemaToOptions)(workflow.registry, schemaJson);
94
- }
95
- getOrCreateWorkflowForBuilder(collectionName) {
96
- return new tools_1.NodeWorkflow(this.context.root, {
97
- resolvePaths: this.getResolvePaths(collectionName),
98
- engineHostCreator: (options) => new schematic_engine_host_1.SchematicEngineHost(options.resolvePaths),
99
- });
100
- }
101
- async getOrCreateWorkflowForExecution(collectionName, options) {
102
- const { logger, root, packageManager } = this.context;
103
- const { force, dryRun, packageRegistry } = options;
104
- const workflow = new tools_1.NodeWorkflow(root, {
105
- force,
106
- dryRun,
107
- packageManager: packageManager.name,
108
- // A schema registry is required to allow customizing addUndefinedDefaults
109
- registry: new core_1.schema.CoreSchemaRegistry(schematics_1.formats.standardFormats),
110
- packageRegistry,
111
- resolvePaths: this.getResolvePaths(collectionName),
112
- schemaValidation: true,
113
- optionTransforms: [
114
- // Add configuration file defaults
115
- async (schematic, current) => {
116
- const projectName = typeof current?.project === 'string' ? current.project : this.getProjectName();
117
- return {
118
- ...(await (0, config_1.getSchematicDefaults)(schematic.collection.name, schematic.name, projectName)),
119
- ...current,
120
- };
121
- },
122
- ],
123
- engineHostCreator: (options) => new schematic_engine_host_1.SchematicEngineHost(options.resolvePaths),
124
- });
125
- workflow.registry.addPostTransform(core_1.schema.transforms.addUndefinedDefaults);
126
- workflow.registry.useXDeprecatedProvider((msg) => logger.warn(msg));
127
- workflow.registry.addSmartDefaultProvider('projectName', () => this.getProjectName());
128
- const workingDir = (0, core_1.normalize)((0, path_1.relative)(this.context.root, process.cwd()));
129
- workflow.registry.addSmartDefaultProvider('workingDirectory', () => workingDir === '' ? undefined : workingDir);
130
- let shouldReportAnalytics = true;
131
- workflow.engineHost.registerOptionsTransform(async (schematic, options) => {
132
- // Report analytics
133
- if (shouldReportAnalytics) {
134
- shouldReportAnalytics = false;
135
- const { collection: { name: collectionName }, name: schematicName, } = schematic;
136
- const analytics = (0, analytics_1.isPackageNameSafeForAnalytics)(collectionName)
137
- ? await this.getAnalytics()
138
- : undefined;
139
- analytics?.reportSchematicRunEvent({
140
- [analytics_parameters_1.EventCustomDimension.SchematicCollectionName]: collectionName,
141
- [analytics_parameters_1.EventCustomDimension.SchematicName]: schematicName,
142
- ...this.getAnalyticsParameters(options),
143
- });
100
+ scope = (__runInitializers(this, _instanceExtraInitializers), command_module_1.CommandScope.In);
101
+ allowPrivateSchematics = false;
102
+ async builder(argv) {
103
+ return argv
104
+ .option('interactive', {
105
+ describe: 'Enable interactive input prompts.',
106
+ type: 'boolean',
107
+ default: true,
108
+ })
109
+ .option('dry-run', {
110
+ describe: 'Run through and reports activity without writing out results.',
111
+ type: 'boolean',
112
+ alias: ['d'],
113
+ default: false,
114
+ })
115
+ .option('defaults', {
116
+ describe: 'Disable interactive input prompts for options with a default.',
117
+ type: 'boolean',
118
+ default: false,
119
+ })
120
+ .option('force', {
121
+ describe: 'Force overwriting of existing files.',
122
+ type: 'boolean',
123
+ default: false,
124
+ })
125
+ .strict();
126
+ }
127
+ /** Get schematic schema options.*/
128
+ async getSchematicOptions(collection, schematicName, workflow) {
129
+ const schematic = collection.createSchematic(schematicName, true);
130
+ const { schemaJson } = schematic.description;
131
+ if (!schemaJson) {
132
+ return [];
144
133
  }
145
- return options;
146
- });
147
- if (options.interactive !== false && (0, tty_1.isTTY)()) {
148
- workflow.registry.usePromptProvider(async (definitions) => {
149
- let prompts;
150
- const answers = {};
151
- for (const definition of definitions) {
152
- if (options.defaults && definition.default !== undefined) {
153
- continue;
154
- }
155
- // Only load prompt package if needed
156
- prompts ??= await Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
157
- switch (definition.type) {
158
- case 'confirmation':
159
- answers[definition.id] = await prompts.confirm({
160
- message: definition.message,
161
- default: definition.default,
162
- });
163
- break;
164
- case 'list':
165
- if (!definition.items?.length) {
166
- continue;
167
- }
168
- const choices = definition.items?.map((item) => {
169
- return typeof item == 'string'
170
- ? {
171
- name: item,
172
- value: item,
173
- }
174
- : {
175
- name: item.label,
176
- value: item.value,
177
- };
178
- });
179
- answers[definition.id] = await (definition.multiselect ? prompts.checkbox : prompts.select)({
180
- message: definition.message,
181
- default: definition.default,
182
- choices,
183
- });
184
- break;
185
- case 'input':
186
- let finalValue;
187
- answers[definition.id] = await prompts.input({
188
- message: definition.message,
189
- default: definition.default,
190
- async validate(value) {
191
- if (definition.validator === undefined) {
192
- return true;
193
- }
194
- let lastValidation = false;
195
- for (const type of definition.propertyTypes) {
196
- let potential;
197
- switch (type) {
198
- case 'string':
199
- potential = String(value);
200
- break;
201
- case 'integer':
202
- case 'number':
203
- potential = Number(value);
204
- break;
205
- default:
206
- potential = value;
207
- break;
134
+ return (0, json_schema_1.parseJsonSchemaToOptions)(workflow.registry, schemaJson);
135
+ }
136
+ getOrCreateWorkflowForBuilder(collectionName) {
137
+ return new tools_1.NodeWorkflow(this.context.root, {
138
+ resolvePaths: this.getResolvePaths(collectionName),
139
+ engineHostCreator: (options) => new schematic_engine_host_1.SchematicEngineHost(options.resolvePaths),
140
+ });
141
+ }
142
+ async getOrCreateWorkflowForExecution(collectionName, options) {
143
+ const { logger, root, packageManager } = this.context;
144
+ const { force, dryRun, packageRegistry } = options;
145
+ const workflow = new tools_1.NodeWorkflow(root, {
146
+ force,
147
+ dryRun,
148
+ packageManager: packageManager.name,
149
+ // A schema registry is required to allow customizing addUndefinedDefaults
150
+ registry: new core_1.schema.CoreSchemaRegistry(schematics_1.formats.standardFormats),
151
+ packageRegistry,
152
+ resolvePaths: this.getResolvePaths(collectionName),
153
+ schemaValidation: true,
154
+ optionTransforms: [
155
+ // Add configuration file defaults
156
+ async (schematic, current) => {
157
+ const projectName = typeof current?.project === 'string' ? current.project : this.getProjectName();
158
+ return {
159
+ ...(await (0, config_1.getSchematicDefaults)(schematic.collection.name, schematic.name, projectName)),
160
+ ...current,
161
+ };
162
+ },
163
+ ],
164
+ engineHostCreator: (options) => new schematic_engine_host_1.SchematicEngineHost(options.resolvePaths),
165
+ });
166
+ workflow.registry.addPostTransform(core_1.schema.transforms.addUndefinedDefaults);
167
+ workflow.registry.useXDeprecatedProvider((msg) => logger.warn(msg));
168
+ workflow.registry.addSmartDefaultProvider('projectName', () => this.getProjectName());
169
+ const workingDir = (0, core_1.normalize)((0, path_1.relative)(this.context.root, process.cwd()));
170
+ workflow.registry.addSmartDefaultProvider('workingDirectory', () => workingDir === '' ? undefined : workingDir);
171
+ let shouldReportAnalytics = true;
172
+ workflow.engineHost.registerOptionsTransform(async (schematic, options) => {
173
+ // Report analytics
174
+ if (shouldReportAnalytics) {
175
+ shouldReportAnalytics = false;
176
+ const { collection: { name: collectionName }, name: schematicName, } = schematic;
177
+ const analytics = (0, analytics_1.isPackageNameSafeForAnalytics)(collectionName)
178
+ ? await this.getAnalytics()
179
+ : undefined;
180
+ analytics?.reportSchematicRunEvent({
181
+ [analytics_parameters_1.EventCustomDimension.SchematicCollectionName]: collectionName,
182
+ [analytics_parameters_1.EventCustomDimension.SchematicName]: schematicName,
183
+ ...this.getAnalyticsParameters(options),
184
+ });
185
+ }
186
+ return options;
187
+ });
188
+ if (options.interactive !== false && (0, tty_1.isTTY)()) {
189
+ workflow.registry.usePromptProvider(async (definitions) => {
190
+ let prompts;
191
+ const answers = {};
192
+ for (const definition of definitions) {
193
+ if (options.defaults && definition.default !== undefined) {
194
+ continue;
195
+ }
196
+ // Only load prompt package if needed
197
+ prompts ??= await Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
198
+ switch (definition.type) {
199
+ case 'confirmation':
200
+ answers[definition.id] = await prompts.confirm({
201
+ message: definition.message,
202
+ default: definition.default,
203
+ });
204
+ break;
205
+ case 'list':
206
+ if (!definition.items?.length) {
207
+ continue;
208
+ }
209
+ const choices = definition.items?.map((item) => {
210
+ return typeof item == 'string'
211
+ ? {
212
+ name: item,
213
+ value: item,
208
214
  }
209
- lastValidation = await definition.validator(potential);
210
- // Can be a string if validation fails
211
- if (lastValidation === true) {
212
- finalValue = potential;
215
+ : {
216
+ name: item.label,
217
+ value: item.value,
218
+ };
219
+ });
220
+ answers[definition.id] = await (definition.multiselect ? prompts.checkbox : prompts.select)({
221
+ message: definition.message,
222
+ default: definition.default,
223
+ choices,
224
+ });
225
+ break;
226
+ case 'input':
227
+ let finalValue;
228
+ answers[definition.id] = await prompts.input({
229
+ message: definition.message,
230
+ default: definition.default,
231
+ async validate(value) {
232
+ if (definition.validator === undefined) {
213
233
  return true;
214
234
  }
215
- }
216
- return lastValidation;
217
- },
218
- });
219
- // Use validated value if present.
220
- // This ensures the correct type is inserted into the final schema options.
221
- if (finalValue !== undefined) {
222
- answers[definition.id] = finalValue;
223
- }
224
- break;
235
+ let lastValidation = false;
236
+ for (const type of definition.propertyTypes) {
237
+ let potential;
238
+ switch (type) {
239
+ case 'string':
240
+ potential = String(value);
241
+ break;
242
+ case 'integer':
243
+ case 'number':
244
+ potential = Number(value);
245
+ break;
246
+ default:
247
+ potential = value;
248
+ break;
249
+ }
250
+ lastValidation = await definition.validator(potential);
251
+ // Can be a string if validation fails
252
+ if (lastValidation === true) {
253
+ finalValue = potential;
254
+ return true;
255
+ }
256
+ }
257
+ return lastValidation;
258
+ },
259
+ });
260
+ // Use validated value if present.
261
+ // This ensures the correct type is inserted into the final schema options.
262
+ if (finalValue !== undefined) {
263
+ answers[definition.id] = finalValue;
264
+ }
265
+ break;
266
+ }
225
267
  }
226
- }
227
- return answers;
228
- });
268
+ return answers;
269
+ });
270
+ }
271
+ return workflow;
229
272
  }
230
- return workflow;
231
- }
232
- async getSchematicCollections() {
233
- // Resolve relative collections from the location of `angular.json`
234
- const resolveRelativeCollection = (collectionName) => collectionName.charAt(0) === '.'
235
- ? (0, path_1.resolve)(this.context.root, collectionName)
236
- : collectionName;
237
- const getSchematicCollections = (configSection) => {
238
- if (!configSection) {
273
+ async getSchematicCollections() {
274
+ // Resolve relative collections from the location of `angular.json`
275
+ const resolveRelativeCollection = (collectionName) => collectionName.charAt(0) === '.'
276
+ ? (0, path_1.resolve)(this.context.root, collectionName)
277
+ : collectionName;
278
+ const getSchematicCollections = (configSection) => {
279
+ if (!configSection) {
280
+ return undefined;
281
+ }
282
+ const { schematicCollections } = configSection;
283
+ if (Array.isArray(schematicCollections)) {
284
+ return new Set(schematicCollections.map((c) => resolveRelativeCollection(c)));
285
+ }
239
286
  return undefined;
240
- }
241
- const { schematicCollections } = configSection;
242
- if (Array.isArray(schematicCollections)) {
243
- return new Set(schematicCollections.map((c) => resolveRelativeCollection(c)));
244
- }
245
- return undefined;
246
- };
247
- const { workspace, globalConfiguration } = this.context;
248
- if (workspace) {
249
- const project = (0, config_1.getProjectByCwd)(workspace);
250
- if (project) {
251
- const value = getSchematicCollections(workspace.getProjectCli(project));
252
- if (value) {
253
- return value;
287
+ };
288
+ const { workspace, globalConfiguration } = this.context;
289
+ if (workspace) {
290
+ const project = (0, config_1.getProjectByCwd)(workspace);
291
+ if (project) {
292
+ const value = getSchematicCollections(workspace.getProjectCli(project));
293
+ if (value) {
294
+ return value;
295
+ }
254
296
  }
255
297
  }
298
+ const value = getSchematicCollections(workspace?.getCli()) ??
299
+ getSchematicCollections(globalConfiguration.getCli());
300
+ if (value) {
301
+ return value;
302
+ }
303
+ return new Set([exports.DEFAULT_SCHEMATICS_COLLECTION]);
256
304
  }
257
- const value = getSchematicCollections(workspace?.getCli()) ??
258
- getSchematicCollections(globalConfiguration.getCli());
259
- if (value) {
260
- return value;
261
- }
262
- return new Set([exports.DEFAULT_SCHEMATICS_COLLECTION]);
263
- }
264
- parseSchematicInfo(schematic) {
265
- if (schematic?.includes(':')) {
266
- const [collectionName, schematicName] = schematic.split(':', 2);
267
- return [collectionName, schematicName];
268
- }
269
- return [undefined, schematic];
270
- }
271
- async runSchematic(options) {
272
- const { logger } = this.context;
273
- const { schematicOptions, executionOptions, collectionName, schematicName } = options;
274
- const workflow = await this.getOrCreateWorkflowForExecution(collectionName, executionOptions);
275
- if (!schematicName) {
276
- throw new Error('schematicName cannot be undefined.');
305
+ parseSchematicInfo(schematic) {
306
+ if (schematic?.includes(':')) {
307
+ const [collectionName, schematicName] = schematic.split(':', 2);
308
+ return [collectionName, schematicName];
309
+ }
310
+ return [undefined, schematic];
277
311
  }
278
- const { unsubscribe, files } = (0, schematic_workflow_1.subscribeToWorkflow)(workflow, logger);
279
- try {
280
- await workflow
281
- .execute({
282
- collection: collectionName,
283
- schematic: schematicName,
284
- options: schematicOptions,
285
- logger,
286
- allowPrivate: this.allowPrivateSchematics,
287
- })
288
- .toPromise();
289
- if (!files.size) {
290
- logger.info('Nothing to be done.');
312
+ async runSchematic(options) {
313
+ const { logger } = this.context;
314
+ const { schematicOptions, executionOptions, collectionName, schematicName } = options;
315
+ const workflow = await this.getOrCreateWorkflowForExecution(collectionName, executionOptions);
316
+ if (!schematicName) {
317
+ throw new Error('schematicName cannot be undefined.');
291
318
  }
292
- if (executionOptions.dryRun) {
293
- logger.warn(`\nNOTE: The "--dry-run" option means no changes were made.`);
319
+ const { unsubscribe, files } = (0, schematic_workflow_1.subscribeToWorkflow)(workflow, logger);
320
+ try {
321
+ await workflow
322
+ .execute({
323
+ collection: collectionName,
324
+ schematic: schematicName,
325
+ options: schematicOptions,
326
+ logger,
327
+ allowPrivate: this.allowPrivateSchematics,
328
+ })
329
+ .toPromise();
330
+ if (!files.size) {
331
+ logger.info('Nothing to be done.');
332
+ }
333
+ if (executionOptions.dryRun) {
334
+ logger.warn(`\nNOTE: The "--dry-run" option means no changes were made.`);
335
+ }
294
336
  }
295
- }
296
- catch (err) {
297
- // In case the workflow was not successful, show an appropriate error message.
298
- if (err instanceof schematics_1.UnsuccessfulWorkflowExecution) {
299
- // "See above" because we already printed the error.
300
- logger.fatal('The Schematic workflow failed. See above.');
337
+ catch (err) {
338
+ // In case the workflow was not successful, show an appropriate error message.
339
+ if (err instanceof schematics_1.UnsuccessfulWorkflowExecution) {
340
+ // "See above" because we already printed the error.
341
+ logger.fatal('The Schematic workflow failed. See above.');
342
+ }
343
+ else {
344
+ (0, error_1.assertIsError)(err);
345
+ logger.fatal(err.message);
346
+ }
347
+ return 1;
301
348
  }
302
- else {
303
- (0, error_1.assertIsError)(err);
304
- logger.fatal(err.message);
349
+ finally {
350
+ unsubscribe();
305
351
  }
306
- return 1;
307
- }
308
- finally {
309
- unsubscribe();
352
+ return 0;
310
353
  }
311
- return 0;
312
- }
313
- getProjectName() {
314
- const { workspace, logger } = this.context;
315
- if (!workspace) {
354
+ getProjectName() {
355
+ const { workspace, logger } = this.context;
356
+ if (!workspace) {
357
+ return undefined;
358
+ }
359
+ const projectName = (0, config_1.getProjectByCwd)(workspace);
360
+ if (projectName) {
361
+ return projectName;
362
+ }
316
363
  return undefined;
317
364
  }
318
- const projectName = (0, config_1.getProjectByCwd)(workspace);
319
- if (projectName) {
320
- return projectName;
365
+ getResolvePaths(collectionName) {
366
+ const { workspace, root } = this.context;
367
+ return workspace
368
+ ? // Workspace
369
+ collectionName === exports.DEFAULT_SCHEMATICS_COLLECTION
370
+ ? // Favor __dirname for @schematics/angular to use the build-in version
371
+ [__dirname, process.cwd(), root]
372
+ : [process.cwd(), root, __dirname]
373
+ : // Global
374
+ [__dirname, process.cwd()];
321
375
  }
322
- return undefined;
323
- }
324
- getResolvePaths(collectionName) {
325
- const { workspace, root } = this.context;
326
- return workspace
327
- ? // Workspace
328
- collectionName === exports.DEFAULT_SCHEMATICS_COLLECTION
329
- ? // Favor __dirname for @schematics/angular to use the build-in version
330
- [__dirname, process.cwd(), root]
331
- : [process.cwd(), root, __dirname]
332
- : // Global
333
- [__dirname, process.cwd()];
334
- }
335
- }
376
+ };
377
+ })();
336
378
  exports.SchematicsCommandModule = SchematicsCommandModule;
337
- __decorate([
338
- memoize_1.memoize,
339
- __metadata("design:type", Function),
340
- __metadata("design:paramtypes", [String]),
341
- __metadata("design:returntype", tools_1.NodeWorkflow)
342
- ], SchematicsCommandModule.prototype, "getOrCreateWorkflowForBuilder", null);
343
- __decorate([
344
- memoize_1.memoize,
345
- __metadata("design:type", Function),
346
- __metadata("design:paramtypes", [String, Object]),
347
- __metadata("design:returntype", Promise)
348
- ], SchematicsCommandModule.prototype, "getOrCreateWorkflowForExecution", null);
349
- __decorate([
350
- memoize_1.memoize,
351
- __metadata("design:type", Function),
352
- __metadata("design:paramtypes", []),
353
- __metadata("design:returntype", Promise)
354
- ], SchematicsCommandModule.prototype, "getSchematicCollections", null);