Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

CLI generates items in unexpected workspace directories

Đang mở
#21,660 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
angular, typescript
Lĩnh vực
cli, tooling

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện các lệnh ng generate component component1 từ một workspace nhiều dự án, so sánh việc tạo từ thư mục gốc của dự án với việc tạo từ src/app hoặc src/lib. Được xem là hoàn tất khi việc tạo từ thư mục gốc của dự án đặt các mục vào thư mục mã nguồn dự kiến của dự án và phân giải module mà không yêu cầu đường dẫn tường minh.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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


Ngôn ngữ chính
TypeScript
Star
27k
Fork
11.8k
Merge trung bình
17 giờ 25 phút
Pull request đã merge (30 ngày)
183

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của angular/angular-cli

Tất cả issue của angular/angular-cli

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.