angular / angular/angular-cli

Incorrect use of --directory param

Open
#19,496 1 comment 2 reactions 0 assignees View on GitHub
area: @schematics/angular freq1: low severity3: broken type: bug/fix
Dominant language
TypeScript
Stars
27k
Forks
11.8k
Avg merge
14h 23m
Merged PRs (30d)
162

Description

# 🐞 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

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `ng new app1 --directory=/tmp/app1 --skip-install` with the reported Angular CLI version, then trace the CLI entry point that handles `new` and its `--directory` option. Done means an absolute directory is created at `/tmp/app1`, rather than as `./tmp/app1`, without regressing relative paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.