Skip to content

generators: allow dash - in selector before a number #25164

@sod

Description

@sod

Command

generate

Description

We use jira. Tickets always follow the schema <PROJECT>-<TICKETNUMBER> so e.g. Task-123. If we do an a/b test, we like to postfix the files that mirror the control group with the ticket, so e.g feature-task-123.component.ts. But the cli right now doesn't allow this.

See ng g c TodoItemTask123 neither the files nor the selector have the -. So task-123 is actually task123:
CleanShot 2023-05-08 at 13 48 53@2x

So what I'd like to do would be one of these:

ng g c TodoItemTask-123
ng g c TodoItemTask123 --selector app-todo-item-task-123

but both commands get rejected with Selector "app-todo-item-task-123" is invalid:
CleanShot 2023-05-08 at 13 46 29@2x

Describe the solution you'd like

I'd like if ng g c TodoItemTask-123 was allowed and generates files like:

todo-item-task-123.component.ts
              ^ having the dash

Describe alternatives you've considered

Renaming all the files and updating the NgModule by hand afterwards.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions