Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

CLI generates items in unexpected workspace directories

Open
#21,660 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
angular, typescript
Domain
cli, tooling

Research direction

Start by reproducing the ng generate component component1 commands from a multi-project workspace, comparing generation from the project root with generation from src/app or src/lib. Done means generation from the project root places items under the expected project source directory and resolves the module without requiring an explicit path.

Written by the indexing model from the issue text.

Description

area: @angular/cli freq1: low severity2: inconvenient type: bug/fix

🐞 Bug report

Command
  • generate
Description

In a multi-project workspace, ng generate creates items (components, etc.) based on the current directory, rather than [ProjectRoot]/src/app or [ProjectRoot/src/lib.

In a single-project workspace, the CLI knows to place items inside of src.... However, in a multi-project workspace with a projects/... directory structure, the developer must navigate to src/app or src/lib prior to generating the item, or specify its location, such as:

cd ./projects/app1/src/app
ng generate component component1

or

cd ./projects/app1
ng generate component src/app/component1 -module src/app/app

The expectation would be to navigate to the root of the project, then generate items in the same manner as a single-project workspace, such as:

cd ./projects/app1
ng generate component component1

Ideally, developers would not have to worry about where they are within the project directory structure or having to specify the location of the module (particularly in default module configurations).

🌍 Your Environment


Angular CLI: 12.2.2
Node: 14.16.0
Package Manager: npm 7.21.0
OS: win32 x64

Angular: 12.2.2
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, material, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1202.2
@angular-devkit/build-angular   12.2.2
@angular-devkit/core            12.2.2
@angular-devkit/schematics      12.2.2
@schematics/angular             12.2.2
ng-packagr                      12.2.0
rxjs                            6.6.7
typescript                      4.3.5


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.