angular / angular/angular-cli

Have NodePackageInstallTask use project directory if no directory specified

未關閉
#21,680 8 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area: @angular-devkit/schematics feature feature: insufficient votes
主要語言
TypeScript
星號
27k
分支
11.8k
平均合併
14 小時 23 分鐘
30 天內合併 PR
162

描述

# 🚀 Feature request

### Command (mark with an `x`)

- [x] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [x] add
- [ ] update
- [ ] lint
- [ ] extract-i18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

### Description

A clear and concise description of the problem or missing capability...

`NodePackageInstallTask` is frequently used by add tasks such as `ng-add` in `@angular/material`. If a schematic like this is called from a custom `ng-new` schematic using `externalSchematic` the install fails because it is run from some non-project directory rather than from inside the newly created project directory.

### Describe the solution you'd like

If you have a solution in mind, please describe it.

Since schematics knows the location of `package.json` it should by default run `NodePackageInstallTask` from that same directory rather than using the working directory.

This would unfortunately qualify as a "breaking" change so a configuration option might be necessary to allow for the "old" (current) behavior once this change is made.

### Describe alternatives you've considered

Have you considered any alternative solutions or workarounds?
The only work-around I've been able to do is essentially replicating the behaviors of third-party schematic "add" tasks within my custom schematic and then running install after the fact which is less than ideal.

貢獻指南

開啟貢獻指南

研究方向

在 Angular CLI schematics 程式碼中找出 NodePackageInstallTask 和 package.json 路徑處理邏輯。重現 externalSchematic ng-new 情境,接著驗證 new 和 add 工作預設會從新建立的專案目錄進行安裝,並確認要求的相容性選項會保留現有行為。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
angular, typescript
領域
cli, tooling
Issue 類型
功能
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。