angular / angular/angular-cli

Have NodePackageInstallTask use project directory if no directory specified

オープン
#21,680 コメント 8 件 リアクション 0 件 担当者 0 名 GitHub で見る
area: @angular-devkit/schematics feature feature: insufficient votes
主要言語
TypeScript
スター
27k
フォーク
11.8k
平均マージ
14時間 23分
マージ済み PR(30日)
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 を短くまとめたダイジェスト。