Have NodePackageInstallTask use project directory if no directory specified

未关闭
#21,680 8 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
angular, typescript
领域
cli, tooling

调研方向

在 Angular CLI schematics 代码中定位 NodePackageInstallTask 和 package.json 路径处理逻辑。复现 externalSchematic ng-new 场景,然后验证 new 和 add 任务默认从新创建的项目目录进行安装,并验证请求的兼容性选项保留现有行为。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
TypeScript
星标
27k
派生
11.8k
平均合并
16 小时 35 分钟
30 天内合并 PR
176

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

angular/angular-cli 的其他 Issue

查看 angular/angular-cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。