angular / angular/angular-cli

ng add - please specify a project name

未关闭
#11,016 3 条评论 17 个 reaction 已指派 0 人 在 GitHub 查看
area: @angular/cli feature feature: insufficient votes
主要语言
TypeScript
星标
27k
派生
11.8k
平均合并
14 小时 23 分钟
30 天内合并 PR
162

描述

### Versions
```sh

_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/

Angular CLI: 6.0.5
Node: 10.1.0
OS: darwin x64
Angular: 6.0.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package Version
------------------------------------------------------------
@angular-devkit/architect 0.6.5
@angular-devkit/build-angular 0.6.5
@angular-devkit/build-ng-packagr 0.6.5
@angular-devkit/build-optimizer 0.6.5
@angular-devkit/core 0.6.5
@angular-devkit/schematics 0.6.5
@angular/cli 6.0.5
@angular/material 6.1.0
@ngtools/json-schema 1.1.0
@ngtools/webpack 6.0.5
@schematics/angular 0.6.5
@schematics/update 0.6.5
ng-packagr 3.0.0-rc.5
rxjs 6.2.0
typescript 2.7.2
webpack 4.8.3
```

### Repro steps

* Step 1
starting a new project with `ng new angular-project`
* Step 2
generate a library/application inside the new angular-cli project
```sh
ng g library mylibrary
ng g application myapp
```
* Step 3
Add @angular/material
```
ng add @angular/material myapp
Installing packages for tooling via npm.
Multiple projects are defined; please specify a project name
```

### Observed behavior

`@angular/material` gets correclty installed in the node dependencies but the `myapp` project is not configured for using the library.

### Desired behavior

The current `ng add` usage is: `usage: ng add `
Ideally this should allow passing the target app like this:

```sh
usage: ng add [options]
options:
--project
The name of the project.
```

贡献指南

打开贡献指南

调研方向

首先,在同时包含 `mylibrary` 和 `myapp` 的 workspace 中复现 `ng add @angular/material myapp` 流程,然后跟踪 `ng add` 命令的入口点。当该命令接受项目名称并为 Angular Material 配置 `myapp`,而不只是安装 package 时,即表示完成。

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

评估

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

把新 issue 发到你的邮箱

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