Better support `ng new` use cases
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- angular, typescript
调研方向
首先审查现有的 ng new 和 ng generate 行为,以及链接的 Angular 工作区文件结构文档。将当前的 --create-application=false 流程与所请求的应用程序、库和多应用程序用例进行比较。在实现之前,必须就工作区术语和命令边界达成一致方向,才算完成。
由索引模型根据 Issue 内容生成。
描述
🚀 Feature request
/cc @mgechev
Command (mark with an x)
- new
- generate
Description
We should rethink some of the DX around ng new, as it was originally intended to make new Angular applications, but has expanded somewhat, particularly with monorepos. There are three things in particular which are a bit awkward:
- There is no way to create an Angular library (using the CLI) without using a monorepo structure. This may not be desired and makes library authorship a little more awkward.
- To use a monorepo structure, users are supposed to use
ng new --create-application=false, which is a pretty awkward syntax and doesn't make clear that this is intended for a monorepo/multi-app workspace. - Reevaluate the definition of "workspace". I can't speak for others, but I always interpreted a "workspace" as effectively a monorepository for Angular apps. Looking through docs, it seems that anything with an
angular.jsonfile is technically a "workspace", song newtechnically creates a workspace, even though it isn't a monorepo. I think this definition of "workspace" only really applies internally so we should think more critically about the language here.
Additional context: https://twitter.com/justinfagnani/status/1373336274384293889
Describe the solution you'd like
I'm thinking we could add an extra flag to ng new to decide whether to make a standalone application (ng new --type app), a multi-app workspace (ng new --type workspace, equivalent to today's ng new --create-application=false), or a standalone library (ng new --type library). Note that ng new --type app and ng new --type library both technically create a "workspace" per the above definition. We might want to either tweak the definition of "workspace" to mean "a multi-app Angular repo" or use something like ng new --type empty-workspace.
This would be distinguished from ng generate because ng new makes a new repository while ng generate works within an existing repository. Arguably we should merge ng new and ng generate (maybe inferring from file path context whether a new repository is required).
Some of the broader questions we should discuss:
- How should we position Angular "workspaces"? Are they for monorepositories or not?
- How should
ng newandng generatework together or be merged?
Describe alternatives you've considered
Apparently you can use ng-packagr to generate a library without a workspace, but you're losing a lot of the benefits of the CLI by doing so: https://twitter.com/Splaktar/status/1373373386802479105
- 主要语言
- TypeScript
- 星标
- 27k
- 派生
- 11.8k
- 平均合并
- 17 小时 25 分钟
- 30 天内合并 PR
- 183
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
angular/angular-cli 的其他 Issue
-
area: @angular/build gemini-triaged
难度 2/5 1-3 小时 新手友好度 74/100
angular/angular-cli#33955 ·
-
area: @angular/cli gemini-triaged
难度 2/5 1-3 小时 新手友好度 72/100
angular/angular-cli#33055 · 1 条评论 · 3 个 reaction ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 已指派 1 人 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 已指派 1 人 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34128 · 已指派 1 人 ·
查看 angular/angular-cli 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
safetrustcr/dApp-SafeTrust#426 ·
-
area:workflow bug ready-for-agent
难度 2/5 1-3 小时 新手友好度 75/100
fil-donadoni/tolaria#4409 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
Fission-AI/OpenSpec#1960 ·
-
Add dependabot 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 75/100
corsairdev/corsair#1764 ·