angular / angular/angular-cli

Have NodePackageInstallTask use project directory if no directory specified

Abierto
#21,680 8 comentarios 0 reacciones 0 asignados Ver en GitHub
area: @angular-devkit/schematics feature feature: insufficient votes
Lenguaje dominante
TypeScript
Estrellas
27k
Forks
11.8k
Merge medio
14 h 23 min
PR fusionados (30 d)
162

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Localiza NodePackageInstallTask y el manejo de la ruta de package.json en el código de schematics de Angular CLI. Reproduce el escenario externalSchematic ng-new y, después, verifica que las tareas new y add instalan de forma predeterminada desde el directorio del proyecto recién creado y que la opción de compatibilidad solicitada conserva el comportamiento existente.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, typescript
Área
cli, tooling
Tipo de issue
Nueva funcionalidad
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.