Thanks to visit codestin.com
Credit goes to github.com

Skip to content

CLI: [command new] add option to enable previous suffix generation on create #30594

Open
@giacomo

Description

@giacomo

Which @angular/* package(s) are relevant/related to the feature request?

compiler-cli

Description

The problem:

Starting in Angular v20, by default Angular CLI will not generate suffixes

As written in https://blog.angular.dev/announcing-angular-v20-b5c9c06cf301

Starting in Angular v20, by default Angular CLI will not generate suffixes for your components, directives, services, and pipes. For existing projects, ng update will enable suffix generation by updating your angular.json. To enable suffix generation in new projects, use the following schematic configuration:

{
  "projects": {
    "app": {
      ...
      "schematics": {
        "@schematics/angular:component": { "type": "component" },
        "@schematics/angular:directive": { "type": "directive" },
        "@schematics/angular:service": { "type": "service" },
        "@schematics/angular:guard": { "typeSeparator": "." },
        "@schematics/angular:interceptor": { "typeSeparator": "." },
        "@schematics/angular:module": { "typeSeparator": "." },
        "@schematics/angular:pipe": { "typeSeparator": "." },
        "@schematics/angular:resolver": { "typeSeparator": "." }
      },
  ...
}

Proposed solution

The solution:

To add an option to the new command, to be able to create a new application with suffixes:

ng new angular-app --with-suffix

This command will automatically add schematics to the angular.json and creates e.g. app.component.ts instead off app.ts

Alternatives considered

The only way to achive this, add manually the schematics and rename the auto generated files manually.
This is time consuming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions