You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-9Lines changed: 38 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,29 @@
1
1
# NgRx Entity Generator
2
2
3
-
## Usage
3
+
## How to Use
4
+
5
+
### Run schematic
6
+
7
+
Generate Entity files
8
+
9
+
```shell
10
+
ng g @briebug/ngrx-entity-schematic:ngrx-entity-schematic ENTITY_NAME
11
+
```
12
+
13
+
Generate Entity files at a specific relative path
14
+
15
+
```shell
16
+
ng g @briebug/ngrx-entity-schematic:ngrx-entity-schematic ENTITY_NAME --path RELATIVE/PATH
17
+
```
18
+
19
+
Generate Entity files with NgRx setup files
20
+
21
+
```shell
22
+
ng g @briebug/ngrx-entity-schematic:ngrx-entity-schematic ENTITY_NAME --init
23
+
```
24
+
25
+
-`ENTITY_NAME`, `--path`, and `--init` flags can be used together.
26
+
-`ENTITY_NAME` is **required** as the first argument after the schematic name
4
27
5
28
## Development
6
29
@@ -12,10 +35,10 @@ yarn link:schematic
12
35
13
36
### Run schematic locally
14
37
15
-
Compile the schematic code
38
+
You can run or re-run schematic against `sandbox-app` and pass options
16
39
17
40
```shell
18
-
yarn build:schematic
41
+
yarn launch ENTITY_NAME --init
19
42
```
20
43
21
44
Reset the `sandbox-app` to it's version controlled state, then execute the schematic locally against the `sandbox-app`.
@@ -24,6 +47,12 @@ Reset the `sandbox-app` to it's version controlled state, then execute the schem
24
47
yarn clean:launch
25
48
```
26
49
50
+
Compile the schematic code if changes have been made to `./src/*`
51
+
52
+
```shell
53
+
yarn build:schematic
54
+
```
55
+
27
56
### Copy `schematic-src` files into schematic template files
28
57
29
58
Read the blueprint app, `/schematic-src`, and copy all the necessary files into the schematic folder, `/src/__files__`. During the copy, replace all "entity" placeholders with their respective template placeholder. Run this if changes to the `schematic-src` app have been made.
@@ -41,19 +70,19 @@ yarn build:run:fileBuilder
41
70
42
71
#### About
43
72
44
-
This schematic uses a template project that's the working blueprint for what the schematic will eventually generate. This pattern was chosen to provide a faster and easier development cycle when testing the template app as a standalone application with the typical dev feedback provided by the Angular CLI. The alternative would involve developing against the template files (which include template variable like `<%= classify(name) %>`) and having to run the schematic locally on every change.
73
+
This schematic uses a template project that acts as the working blueprint for what the schematic will eventually generate. This pattern was chosen to provide a faster and easier development cycle when testing the blueprint app as a standalone application providing the typical dev feedback by the Angular CLI and other devtools. The alternative would involve developing against the template files (which include template variables like `<%= classify(name) %>`) and having to run the schematic locally on every change.
45
74
46
75
### Developing the `buildFiles` script
47
76
48
-
When editing the script that copies and modifies the blueprint files into the schematic directory. The following commands all for quick dev feedback and debugging.
77
+
This script copies and modifies the blueprint Entity files into the schematic `__files__`directory. The following commands allow for quick dev feedback and debugging.
49
78
50
79
Compile the `buildFiles` script into `/tmp` in one shell
51
80
52
81
```shell
53
82
build:fileBuilder
54
83
```
55
84
56
-
In another shell, run the script and watch the `/tmp` dir for changes. Allows for attaching a debugger on port `9222`. See the attached `.vscode/launch.json` file for debugging with VSCode.
85
+
In another shell, run the following script which will watch the `/tmp` dir for changes. Allows for attaching a debugger on port `9222`. See the attached `.vscode/launch.json` file for debugging with VSCode. Run the `Attach Schematic` debugger.
57
86
58
87
```shell
59
88
run:fileBuilder
@@ -65,12 +94,12 @@ Once both of these are run, changes to `./buildFiles.ts` should recompile and tr
65
94
66
95
### ./src
67
96
68
-
This is the schematic code that's executed when running `ng g @briebug/ngrx-entity-schematic`.
97
+
This is the schematic code that's executed when running `ng g @briebug/ngrx-entity-schematic:ngrx-entity-schematic`.
69
98
70
99
### ./schematic-src
71
100
72
-
This the blueprint used for generating the schematic, specifically in template files in `./src/ngrx-entity/__files__`. This is a working application that defines the final form of the schematic.
101
+
This is the blueprint app used for generating the schematic, specifically the template files in `./src/ngrx-entity/__files__`. This is a working application that defines the final form of the schematic.
73
102
74
103
### ./sandbox-app
75
104
76
-
This is an application that's used for testing the schematic locally for development.
105
+
This is an application that's used for testing the schematic locally during development.
0 commit comments