angular / angular/angular-cli

Incorrect use of --directory param

未关闭
#19,496 1 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
area: @schematics/angular freq1: low severity3: broken type: bug/fix
主要语言
TypeScript
星标
27k
派生
11.8k
平均合并
14 小时 23 分钟
30 天内合并 PR
162

描述

# 🐞 Bug report

### Command (mark with an `x`)

- [x] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] extract-i18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

### Is this a regression?

No, this issue has been in the CLI for a long time

### Description

When using the `--directory` param with the absolute path, the CLI does not respect the value and creates the directory path relative to the current directory instead.

## 🔬 Minimal Reproduction

Run the following command:

```shell
ng new app1 --directory=/tmp/app1 --skip-install
```

Expected behaviour:

The application is generated within `/tmp/app1` directory.

Actual behaviour:

The application is generated within current directory: `./tmp/app1`

## 🌍 Your Environment

Angular CLI: 11.0.2
Node: 14.15.0
OS: darwin x64

Angular:
...
Ivy Workspace:

Package Version
------------------------------------------------------
@angular-devkit/architect 0.1100.2 (cli-only)
@angular-devkit/core 11.0.2 (cli-only)
@angular-devkit/schematics 11.0.2 (cli-only)
@schematics/angular 11.0.2 (cli-only)
@schematics/update 0.1100.2 (cli-only)

**Anything else relevant?**

Using macOS

贡献指南

打开贡献指南

调研方向

首先,使用报告中的 Angular CLI 版本重现 `ng new app1 --directory=/tmp/app1 --skip-install`,然后跟踪处理 `new` 及其 `--directory` 选项的 CLI 入口点。完成的标准是在 `/tmp/app1` 创建绝对目录,而不是创建在 `./tmp/app1`,同时不影响相对路径。

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

评估

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

把新 issue 发到你的邮箱

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