angular / angular/angular-cli

Introduce "add-type-to-class-name" option to Ng Generate Application and Ng New

未关闭
#31,582 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area: @schematics/angular feature feature: insufficient votes
主要语言
TypeScript
星标
27k
派生
11.8k
平均合并
14 小时 23 分钟
30 天内合并 PR
162

描述

### Command

new, generate

### Description

To enhance Angular CLI so that developer can control whether the app component generated during ng new or ng generate application will have the Type appended to its class name (i.e AppComponent) or not.

In addition, to allow developer to set a default angular.json's schematics **"addTypeToClassName" to true** via command line, so that future creation of component (include service and directive) via CLI will by default include the type inside the classname.

### Describe the solution you'd like

1. introduce **add-type-to-class-name** option to Ng Generate Application and Ng New, OR
2. rename the "file-name-style-guide" option to "style-guide", with 4 possible values
**addTypeToClassNameOnly**, **addTypeToFileNameOnly**, **addTypeToFileAndClassName**, **2025**

Doing so, will set the **addTypeToClassName to true** inside the angular.json for component, service and directive

### Describe alternatives you've considered

Currently, developer has to manually change the class name for the App Component to include the Type

贡献指南

打开贡献指南

调研方向

Start with the ng new and ng generate application command entry points and the angular.json schematics configuration described in the issue. Trace how application options are applied, then verify that the requested option can set addTypeToClassName for future component, service, and directive generation.

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
cli, tooling
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。