Feature Request: Use schematics for project transformations
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript
Hướng nghiên cứu
Rà soát các triển khai hiện có của các lệnh tns generate, tns plugin add và tns create, cùng với cách các template NativeScript và việc thiết lập plugin hiện đang hoạt động. So sánh chúng với các workflow Schematics được mô tả và xác định phạm vi tích hợp; được coi là hoàn tất khi các lệnh bị ảnh hưởng hỗ trợ các phép biến đổi dựa trên schematic được đề xuất và việc thực thi tác vụ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What is Schematics?
Schematics is a workflow tool for project transformations, such as scaffolding, file updates and tasks execution (npm install, git init). It can apply rules* from predefined collections - for example generate a new Angular project using the @schematics/angular collection or set up Kendo UI using the @progress/kendo-schematics collection.
* rules - should also be called schematics, but that's confusing, so I'll stick to the name rules instead.
Who uses Schematics?
Schematics is extensively used inside the Angular CLI. It's the backbone of the commands:
- ng new - generates the files for a new Angular project, initializes a git repository and installs the node dependencies. It supports a large range of options, such as
routing- whether routing configuration should be generated,styling- what css preprocessor should be used,skipTests- whether test setup should be generated, etc. - ng generate - performs project transformations using a provided rule name and collection.
- ng add - installs a plugin and executes the setup logic provided by the plugin. For example -
ng add @nativescript/schematicsconverts the project to a code-sharing structure by adding all necessary NativeScript dependencies and the minimal setup for running a mobile app.
How can Schematics be used in the NativeScript CLI?
1. tns generate
Create a command that behaves similarly to ng generate. The @nativescript/schematics collection can be extended with non-Angular rules (Vue.js, plain NativeScript). This will allow all NativeScript developers to use schematics in their projects.
2. tns plugin add
There is already a tns plugin add command in NativeScript CLI, which installs NativeScript plugins and performs project modifications.
With schematics, the NativeScript CLI can:
- Perform the project modifications. The advantage over the current implementation is that with
Schematicsall changes are recorded in memory and are executed only after they're confirmed to be valid. In other words - if the command fails, no changes will be applied to the project. - Execute setup rules distributed by the plugins, similarly to
ng add. This will simplify the setup of plugins which currently rely on executingpostinstallscripts, such asnativescript-dev-webpackandnativescript-plugin-firebase.
It will also allow every NativeScript plugin to add a rule to automate the setup of the plugin. For example, thenativescript-pro-uiplugin will be able to provide a rule, which imports its NgModule in the root NgModule if the project uses Angular.
3. tns create
Schematics provides a powerful template engine. The NativeScript templates can be turned into schematic rules. The benefits:
- a lot of the common parts (such as
package.json) will be reused; - new project options will be trivial to add (
routing,style,sidedrawer,tabview, etc.); - the rules will be hosted in a monorepo instead of separated repos for each template.
Also, the NativeScript CLI will be able to perform tasks, similarly to the Angular CLI - it could initialize a git repository for the project, install the project dependencies, etc.
Please share your feedback in the comments!
- Ngôn ngữ chính
- JavaScript
- Star
- 1.1k
- Fork
- 204
- Merge trung bình
- 1 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 8
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NativeScript/nativescript-cli
-
in-progress
NativeScript/nativescript-cli#6140 · 2 bình luận · 1 người được giao ·
-
NativeScript/nativescript-cli#6090 · 1 người được giao ·
-
in progress
NativeScript/nativescript-cli#6015 · 1 reaction · 1 người được giao ·
-
question
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
NativeScript/nativescript-cli#5992 · 5 bình luận ·
-
feature-pending-triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
NativeScript/nativescript-cli#5975 ·
Tất cả issue của NativeScript/nativescript-cli
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
sugarlabs/musicblocks#8847 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Request: SumUp Đang mởnew icon permissions in review
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
simple-icons/simple-icons#15027 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
TheOdinProject/curriculum#31408 ·