Incorrect use of --directory param

Open
#19,496 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

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.

Description

area: @schematics/angular freq1: low severity3: broken type: bug/fix

🐞 Bug report

Command (mark with an 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:

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

Dominant language
TypeScript
Stars
27k
Forks
11.8k
Avg merge
16h 35m
Merged PRs (30d)
176

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from angular/angular-cli

All issues in angular/angular-cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.