@angular/cli 14.2.3 → 14.2.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/cli",
3
- "version": "14.2.3",
3
+ "version": "14.2.4",
4
4
  "description": "CLI tool for Angular",
5
5
  "main": "lib/cli/index.js",
6
6
  "bin": {
@@ -25,10 +25,10 @@
25
25
  },
26
26
  "homepage": "https://github.com/angular/angular-cli",
27
27
  "dependencies": {
28
- "@angular-devkit/architect": "0.1402.3",
29
- "@angular-devkit/core": "14.2.3",
30
- "@angular-devkit/schematics": "14.2.3",
31
- "@schematics/angular": "14.2.3",
28
+ "@angular-devkit/architect": "0.1402.4",
29
+ "@angular-devkit/core": "14.2.4",
30
+ "@angular-devkit/schematics": "14.2.4",
31
+ "@schematics/angular": "14.2.4",
32
32
  "@yarnpkg/lockfile": "1.1.0",
33
33
  "ansi-colors": "4.1.3",
34
34
  "debug": "4.3.4",
@@ -49,12 +49,12 @@
49
49
  "ng-update": {
50
50
  "migrations": "@schematics/angular/migrations/migration-collection.json",
51
51
  "packageGroup": {
52
- "@angular/cli": "14.2.3",
53
- "@angular-devkit/architect": "0.1402.3",
54
- "@angular-devkit/build-angular": "14.2.3",
55
- "@angular-devkit/build-webpack": "0.1402.3",
56
- "@angular-devkit/core": "14.2.3",
57
- "@angular-devkit/schematics": "14.2.3"
52
+ "@angular/cli": "14.2.4",
53
+ "@angular-devkit/architect": "0.1402.4",
54
+ "@angular-devkit/build-angular": "14.2.4",
55
+ "@angular-devkit/build-webpack": "0.1402.4",
56
+ "@angular-devkit/core": "14.2.4",
57
+ "@angular-devkit/schematics": "14.2.4"
58
58
  }
59
59
  },
60
60
  "engines": {
@@ -39,7 +39,7 @@ class ArchitectBaseCommandModule extends command_module_1.CommandModule {
39
39
  await this.reportAnalytics({
40
40
  ...(await architectHost.getOptionsForTarget(target)),
41
41
  ...options,
42
- });
42
+ }, undefined /** paths */, undefined /** dimensions */, builderName);
43
43
  const { logger } = this.context;
44
44
  const run = await this.getArchitect().scheduleTarget(target, options, {
45
45
  logger,
@@ -74,7 +74,7 @@ export declare abstract class CommandModule<T extends {} = {}> implements Comman
74
74
  abstract builder(argv: Argv): Promise<Argv<T>> | Argv<T>;
75
75
  abstract run(options: Options<T> & OtherOptions): Promise<number | void> | number | void;
76
76
  handler(args: ArgumentsCamelCase<T> & OtherOptions): Promise<void>;
77
- reportAnalytics(options: (Options<T> & OtherOptions) | OtherOptions, paths?: string[], dimensions?: (boolean | number | string)[]): Promise<void>;
77
+ reportAnalytics(options: (Options<T> & OtherOptions) | OtherOptions, paths?: string[], dimensions?: (boolean | number | string)[], title?: string): Promise<void>;
78
78
  protected getAnalytics(): Promise<analytics.Analytics>;
79
79
  /**
80
80
  * Adds schema options to a command also this keeps track of options that are required for analytics.
@@ -82,6 +82,13 @@ export declare abstract class CommandModule<T extends {} = {}> implements Comman
82
82
  */
83
83
  protected addSchemaOptionsToCommand<T>(localYargs: Argv<T>, options: Option[]): Argv<T>;
84
84
  protected getWorkspaceOrThrow(): AngularWorkspace;
85
+ /**
86
+ * Flush on an interval (if the event loop is waiting).
87
+ *
88
+ * @returns a method that when called will terminate the periodic
89
+ * flush and call flush one last time.
90
+ */
91
+ private periodicAnalyticsFlush;
85
92
  }
86
93
  /**
87
94
  * Creates an known command module error.
@@ -99,8 +99,10 @@ class CommandModule {
99
99
  }
100
100
  // Gather and report analytics.
101
101
  const analytics = await this.getAnalytics();
102
+ let stopPeriodicFlushes;
102
103
  if (this.shouldReportAnalytics) {
103
104
  await this.reportAnalytics(camelCasedOptions);
105
+ stopPeriodicFlushes = this.periodicAnalyticsFlush(analytics);
104
106
  }
105
107
  let exitCode;
106
108
  try {
@@ -109,7 +111,6 @@ class CommandModule {
109
111
  exitCode = await this.run(camelCasedOptions);
110
112
  const endTime = Date.now();
111
113
  analytics.timing(this.commandName, 'duration', endTime - startTime);
112
- await analytics.flush();
113
114
  }
114
115
  catch (e) {
115
116
  if (e instanceof core_1.schema.SchemaValidationException) {
@@ -121,12 +122,13 @@ class CommandModule {
121
122
  }
122
123
  }
123
124
  finally {
125
+ await (stopPeriodicFlushes === null || stopPeriodicFlushes === void 0 ? void 0 : stopPeriodicFlushes());
124
126
  if (typeof exitCode === 'number' && exitCode > 0) {
125
127
  process.exitCode = exitCode;
126
128
  }
127
129
  }
128
130
  }
129
- async reportAnalytics(options, paths = [], dimensions = []) {
131
+ async reportAnalytics(options, paths = [], dimensions = [], title) {
130
132
  for (const [name, ua] of this.optionsWithAnalytics) {
131
133
  const value = options[name];
132
134
  if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
@@ -137,6 +139,7 @@ class CommandModule {
137
139
  analytics.pageview('/command/' + [this.commandName, ...paths].join('/'), {
138
140
  dimensions,
139
141
  metrics: [],
142
+ title,
140
143
  });
141
144
  }
142
145
  getAnalytics() {
@@ -204,6 +207,23 @@ class CommandModule {
204
207
  }
205
208
  return workspace;
206
209
  }
210
+ /**
211
+ * Flush on an interval (if the event loop is waiting).
212
+ *
213
+ * @returns a method that when called will terminate the periodic
214
+ * flush and call flush one last time.
215
+ */
216
+ periodicAnalyticsFlush(analytics) {
217
+ let analyticsFlushPromise = Promise.resolve();
218
+ const analyticsFlushInterval = setInterval(() => {
219
+ analyticsFlushPromise = analyticsFlushPromise.then(() => analytics.flush());
220
+ }, 2000);
221
+ return () => {
222
+ clearInterval(analyticsFlushInterval);
223
+ // Flush one last time.
224
+ return analyticsFlushPromise.then(() => analytics.flush());
225
+ };
226
+ }
207
227
  }
208
228
  __decorate([
209
229
  memoize_1.memoize
@@ -128,16 +128,9 @@ class SchematicsCommandModule extends command_module_1.CommandModule {
128
128
  workflow.registry.addSmartDefaultProvider('workingDirectory', () => workingDir === '' ? undefined : workingDir);
129
129
  let shouldReportAnalytics = true;
130
130
  workflow.engineHost.registerOptionsTransform(async (schematic, options) => {
131
- var _a;
132
131
  if (shouldReportAnalytics) {
133
132
  shouldReportAnalytics = false;
134
- // ng generate lib -> ng generate
135
- const commandName = (_a = this.command) === null || _a === void 0 ? void 0 : _a.split(' ', 1)[0];
136
- await this.reportAnalytics(options, [
137
- commandName,
138
- schematic.collection.name.replace(/\//g, '_'),
139
- schematic.name.replace(/\//g, '_'),
140
- ]);
133
+ await this.reportAnalytics(options, undefined /** paths */, undefined /** dimensions */, schematic.collection.name + ':' + schematic.name);
141
134
  }
142
135
  // TODO: The below should be removed in version 15 when we change 1P schematics to use the `workingDirectory smart default`.
143
136
  // Handle `"format": "path"` options.