angular / angular/angular-cli

Have NodePackageInstallTask use project directory if no directory specified

Ouverte
#21,680 8 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
area: @angular-devkit/schematics feature feature: insufficient votes
Langage dominant
TypeScript
Étoiles
27k
Forks
11.8k
Merge moyen
14 h 23 min
PR mergées (30 j)
162

Description

# 🚀 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.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Repérez NodePackageInstallTask et la gestion du chemin de package.json dans le code des schematics d’Angular CLI. Reproduisez le scénario externalSchematic ng-new, puis vérifiez que les tâches new et add installent par défaut depuis le répertoire du projet nouvellement créé et que l’option de compatibilité demandée préserve le comportement existant.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
cli, tooling
Type d'issue
Fonctionnalité
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.