mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-18 20:02:40 +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,
|
workingDir === '' ? undefined : workingDir,
|
||||||
);
|
);
|
||||||
|
|
||||||
let shouldReportAnalytics = true;
|
|
||||||
workflow.engineHost.registerOptionsTransform(async (schematic, options) => {
|
workflow.engineHost.registerOptionsTransform(async (schematic, options) => {
|
||||||
// Report analytics
|
const {
|
||||||
if (shouldReportAnalytics) {
|
collection: { name: collectionName },
|
||||||
shouldReportAnalytics = false;
|
name: schematicName,
|
||||||
|
} = schematic;
|
||||||
|
|
||||||
const {
|
const analytics = isPackageNameSafeForAnalytics(collectionName)
|
||||||
collection: { name: collectionName },
|
? await this.getAnalytics()
|
||||||
name: schematicName,
|
: undefined;
|
||||||
} = schematic;
|
|
||||||
|
|
||||||
const analytics = isPackageNameSafeForAnalytics(collectionName)
|
analytics?.reportSchematicRunEvent({
|
||||||
? await this.getAnalytics()
|
[EventCustomDimension.SchematicCollectionName]: collectionName,
|
||||||
: undefined;
|
[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;
|
return options;
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user