Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Have NodePackageInstallTask use project directory if no directory specified

Aberta
#21,680 8 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
45/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
angular, typescript
Domínio
cli, tooling

Direção de pesquisa

Localize NodePackageInstallTask e o tratamento do caminho de package.json no código dos schematics do Angular CLI. Reproduza o cenário externalSchematic ng-new e, em seguida, verifique se as tarefas new e add instalam, por padrão, a partir do diretório do projeto recém-criado e se a opção de compatibilidade solicitada preserva o comportamento existente.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

area: @angular-devkit/schematics feature feature: insufficient votes

🚀 Feature request

Command (mark with an x)
  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • 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.

Linguagem predominante
TypeScript
Estrelas
27k
Forks
11.8k
Merge médio
17h 25min
PRs com merge (30d)
183

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de angular/angular-cli

Todas as issues de angular/angular-cli

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.