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
@@ -88,15 +89,16 @@ The `generateTemplateFiles` function takes an array of `IConfigItem` items.
88
89
89
90
#### `IConfigItem`
90
91
91
-
-`option` - The name of the option to choose when asked.
92
-
-`defaultCase` - The default [Case Converters](#case-converters) to use with the [Replacer Slots](#replacer-slots-or-ireplacerslotquestion) in the template files. Default is `(noCase)`.
93
-
-`entry.folderPath` - Path to a folder of files or a single template file.
92
+
-`option` - The name of the option to choose when asked.
93
+
-`defaultCase` - The default [Case Converters](#case-converters) to use with the [Replacer Slots](#replacer-slots-or-ireplacerslotquestion) in the template files. Default is `(noCase)`.
94
+
-`entry.folderPath` - Path to a folder of files or a single template file.
94
95
95
-
-`stringReplacers` - An array of [Replacer Slots](#replacer-slots-or-ireplacerslotquestion) used to replace content in the designated `entry.folderPath`.
96
-
-`dynamicReplacers` - (Optional) An array of IReplacer used to replace content in the designated `entry.folderPath`.
97
-
-`output.path` - The desired output path for generated files. [Case Converters](#case-converters) and [Replacer Slots](#replacer-slots-or-ireplacerslotquestion) can be used to make the path somewhat dynamic.
98
-
-`output.pathAndFileNameDefaultCase` - The [Case Converters](#case-converters) to use for the file path and file name(s).
99
-
-`onComplete` - (Optional) Takes a callback function that is called once the file(s) have been outputted. A [IResults](#iresults) object will be passed to the callback.
96
+
-`stringReplacers` - An array of [Replacer Slots](#replacer-slots-or-ireplacerslotquestion) used to replace content in the designated `entry.folderPath`.
97
+
-`dynamicReplacers` - (Optional) An array of IReplacer used to replace content in the designated `entry.folderPath`.
98
+
-`output.path` - The desired output path for generated files. [Case Converters](#case-converters) and [Replacer Slots](#replacer-slots-or-ireplacerslotquestion) can be used to make the path somewhat dynamic.
99
+
-`output.pathAndFileNameDefaultCase` - The [Case Converters](#case-converters) to use for the file path and file name(s).
100
+
-`output.overwrite` - (Optional) When `true` it will overwrite any files that are named the same.
101
+
-`onComplete` - (Optional) Takes a callback function that is called once the file(s) have been outputted. A [IResults](#iresults) object will be passed to the callback.
100
102
101
103
###### Example
102
104
@@ -126,9 +128,9 @@ The `generateTemplateFiles` function takes an array of `IConfigItem` items.
126
128
127
129
Below is an example of what you receive from the `onComplete` callback. It has the output path, list of files created and the [Replacer Slots](#replacer-slots-or-ireplacerslotquestion) with the value entered.
128
130
129
-
-`output.path` - The file(s) output path
130
-
-`output.files` - List of files created
131
-
-`stringReplacers` - List of [Replacer Slots](#replacer-slots-or-ireplacerslotquestion); name and values entered during the setup process
131
+
-`output.path` - The file(s) output path
132
+
-`output.files` - List of files created
133
+
-`stringReplacers` - List of [Replacer Slots](#replacer-slots-or-ireplacerslotquestion); name and values entered during the setup process
132
134
133
135
###### Example data you would get from the onComplete callback
134
136
@@ -164,14 +166,14 @@ Below is an example of what you receive from the `onComplete` callback. It has t
164
166
[Replacer Slots](#replacer-slots-or-ireplacerslotquestion) are unique string value(s) to be replaced by the generator. An array of string values and/or `IReplacerSlotQuestion` objects can be used.
165
167
166
168
```javascript
167
-
stringReplacers: ['__store__', {question:'Insert model name', slot:'__model__'}];
169
+
stringReplacers: ['__store__', {question:'Insert model name', slot:'__model__'}];
168
170
```
169
171
170
172
Replacer slot can be any string value you want to use. You can use something like this in your template files and/or in the file path names.
171
173
172
-
-`~replacerSlot~`
173
-
-`{{something else}}`
174
-
-`__AnythingYouWant__`
174
+
-`~replacerSlot~`
175
+
-`{{something else}}`
176
+
-`__AnythingYouWant__`
175
177
176
178
#### `IReplacerSlotQuestion`
177
179
@@ -181,8 +183,8 @@ Below is an example of a `IReplacerSlotQuestion`
181
183
{question:'Insert model name', slot:'__model__'}
182
184
```
183
185
184
-
-`question` - The question to ask the use what value should be used for the replacer `slot`
185
-
-`slot` - The string value for the [Replacer Slots](#replacer-slots-or-ireplacerslotquestion)
186
+
-`question` - The question to ask the use what value should be used for the replacer `slot`
187
+
-`slot` - The string value for the [Replacer Slots](#replacer-slots-or-ireplacerslotquestion)
186
188
187
189
#### Dynamic Replacer Slots
188
190
@@ -200,9 +202,9 @@ dynamicReplacers: [
200
202
201
203
Example
202
204
203
-
-In the generator template `__replacerSlot__` is appended by the `(pascalCase)` converter such as `__replacerSlot__(pascalCase)`.
204
-
-When the generator is ran, the string `"product reducer"` is provided for `__replacerSlot__`.
205
-
-As a result, the converter will produce `ProductReducer`.
205
+
- In the generator template `__replacerSlot__` is appended by the `(pascalCase)` converter such as `__replacerSlot__(pascalCase)`.
206
+
- When the generator is ran, the string `"product reducer"` is provided for `__replacerSlot__`.
207
+
- As a result, the converter will produce `ProductReducer`.
206
208
207
209
Here is the string `Lives down BY the River` with each of the converters:
208
210
@@ -220,32 +222,56 @@ Here is the string `Lives down BY the River` with each of the converters:
220
222
221
223
One Rule: no spaces between the [Replacer Slots](#replacer-slots-or-ireplacerslotquestion) and [Case Converters](#case-converters). If there is a space, [Case Converters](#case-converters) will not work.
222
224
223
-
-:white_check_mark:`__name__(camelCase)`
224
-
-:warning:`__name__ (camelCase)`
225
+
-:white_check_mark:`__name__(camelCase)`
226
+
-:warning:`__name__ (camelCase)`
225
227
226
228
## Command Line Usage
227
229
228
230
You can use `generate-template-files` with the command line to generate your template files.
-`node ./tools/generate.js` - Runs the `generate-template-files` library
245
-
-`angular-ngrx-store` - The template name; It uses the same option name in the [IConfigItem](#iconfigitem) but converts all options names to kebab-case. For example `option: 'Angular Ngrx Store'` will be converted to `angular-ngrx-store` when using the command line
246
-
-`__name__=some-name` - Are [Replacer Slots](#replacer-slots-or-ireplacerslotquestion) and will be converted to `{ slot: "__name__", slotValue: "some-name" }`
247
-
-`--outputpath=./src/here` - Will override the `output.path` in the [IConfigItem](#iconfigitem)
248
-
-`--overwrite` - Will overwrite files if the files already exists
270
+
-`node ./tools/generate.js` - Runs the `generate-template-files` library
271
+
-`create-reduce-action` - The template name; It uses the same option name in the [IConfigItem](#iconfigitem) but converts all options names to kebab-case. For example `option: 'Create Reduce Action'` will be converted to `create-reduce-action` when using the command line
272
+
-`__store__=some-name` - Are [Replacer Slots](#replacer-slots-or-ireplacerslotquestion) and will be converted to `{ slot: "__store__", slotValue: "some-name" }`
273
+
-`--outputpath=./src/here` - Will override the `output.path` in the [IConfigItem](#iconfigitem)
274
+
-`--overwrite` - Will overwrite files if the files already exists
0 commit comments