Skip to content

build: Resolve ng generate aliases before logging analytics #14205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/angular/cli/commands/generate-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import { parseJsonSchemaToSubCommandDescription } from '../utilities/json-schema
import { Schema as GenerateCommandSchema } from './generate';

export class GenerateCommand extends SchematicCommand<GenerateCommandSchema> {
// Allows us to resolve aliases before reporting analytics
longSchematicName: string|undefined;

async initialize(options: GenerateCommandSchema & Arguments) {
await super.initialize(options);

Expand All @@ -29,6 +32,7 @@ export class GenerateCommand extends SchematicCommand<GenerateCommandSchema> {

for (const name of schematicNames) {
const schematic = this.getSchematic(collection, name, true);
this.longSchematicName = schematic.description.name;
let subcommand: SubCommandDescription;
if (schematic.description.schemaJson) {
subcommand = await parseJsonSchemaToSubCommandDescription(
Expand Down Expand Up @@ -81,9 +85,10 @@ export class GenerateCommand extends SchematicCommand<GenerateCommandSchema> {
if (!schematicName || !collectionName) {
return;
}
const escapedSchematicName = (this.longSchematicName || schematicName).replace(/\//g, '_');

return super.reportAnalytics(
['generate', collectionName.replace(/\//g, '_'), schematicName.replace(/\//g, '_')],
['generate', collectionName.replace(/\//g, '_'), escapedSchematicName],
options,
);
}
Expand Down