mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-18 11:44:05 +08:00
fix(@angular/cli): record analytics for nested schematics
Prior to this commit, analytics were not recorded for nested schematics. This caused certain data to be incomplete. For example, when running `ng new` and selecting "yes" for SSR in the prompt, this choice was not recorded because the prompt exists within the `application` schematic.
This commit is contained in:
parent
e8958e363b
commit
2d03d8f113
@ -143,27 +143,21 @@ export abstract class SchematicsCommandModule
|
||||
workingDir === '' ? undefined : workingDir,
|
||||
);
|
||||
|
||||
let shouldReportAnalytics = true;
|
||||
workflow.engineHost.registerOptionsTransform(async (schematic, options) => {
|
||||
// Report analytics
|
||||
if (shouldReportAnalytics) {
|
||||
shouldReportAnalytics = false;
|
||||
const {
|
||||
collection: { name: collectionName },
|
||||
name: schematicName,
|
||||
} = schematic;
|
||||
|
||||
const {
|
||||
collection: { name: collectionName },
|
||||
name: schematicName,
|
||||
} = schematic;
|
||||
const analytics = isPackageNameSafeForAnalytics(collectionName)
|
||||
? await this.getAnalytics()
|
||||
: undefined;
|
||||
|
||||
const analytics = isPackageNameSafeForAnalytics(collectionName)
|
||||
? await this.getAnalytics()
|
||||
: undefined;
|
||||
|
||||
analytics?.reportSchematicRunEvent({
|
||||
[EventCustomDimension.SchematicCollectionName]: collectionName,
|
||||
[EventCustomDimension.SchematicName]: schematicName,
|
||||
...this.getAnalyticsParameters(options as unknown as {}),
|
||||
});
|
||||
}
|
||||
analytics?.reportSchematicRunEvent({
|
||||
[EventCustomDimension.SchematicCollectionName]: collectionName,
|
||||
[EventCustomDimension.SchematicName]: schematicName,
|
||||
...this.getAnalyticsParameters(options as unknown as {}),
|
||||
});
|
||||
|
||||
return options;
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user