Skip to content

Commit d8b0437

Browse files
committed
update docs for creating templates
1 parent 9fbd48f commit d8b0437

File tree

3 files changed

+75
-3
lines changed

3 files changed

+75
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ For that you cannot use the `.phar` binary, so you need to install the project:
4646

4747
### Contribute with new templates
4848

49-
* If you want to contribute with new templates, just do the following:
49+
* If you want to contribute with new templates, just follow this manual:
5050

51-
0. Create a new template following the manual: [How to create templates](vendor/staempfli/universal-code-generator/docs/createTemplates.md)
51+
0. [How to create templates](docs/createTemplates.md)
5252

5353
### Private Templates
5454

5555
If current templates do not fill your needs, you can easily create your own templates. Just follow the manual:
5656

57-
* [How to create private templates](vendor/staempfli/universal-code-generator/docs/privateTemplates.md)
57+
* [How to create private templates](docs/privateTemplates.md)
5858

5959
## Prerequisites
6060

docs/createTemplates.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# How to create new templates
2+
3+
In order to create new templates you just need to do the following.
4+
5+
## Template files
6+
7+
0. Create new folder with your `templateName` into the `templates` folder.
8+
0. Create you template files under your new template.
9+
0. Set your placeholders:
10+
* Placeholders must have the following format `${param_name}`
11+
* Placeholders are possible on files content as well as on folder/file names.
12+
13+
## Template documentation
14+
15+
0. Create a new folder called `.no-copied-config` into you template
16+
0. Add there a description.txt file with a short description that clarifies what the template is for:
17+
* This description will be show when running `./mg2-codegen.phar template:info <template>`
18+
19+
### OPTIONAL
20+
21+
* If your template requires some manual steps after the code is generated, you can document this info in:
22+
* `.no-copied-config/after-generate-info.txt`
23+
* This info will be displayed at the end of the code generation command. You can also use placeholders on this file.
24+
25+
* If you want that your template executes other templates before, you can set dependencies in:
26+
* `.no-copied-config/config.yml`
27+
28+
```
29+
dependencies:
30+
0: <template-name>
31+
1: <template-name>
32+
```
33+
34+
### Example
35+
36+
You can check a template example here [Template Samples](../samples)
37+
38+
## Important info
39+
40+
### Built-in Properties
41+
42+
Following properties are automatically set:
43+
44+
* `vendorname` -> calculated from registration.php
45+
* `modulename` -> calculated from registration.php
46+
* `CommentsCompanyName`
47+
* `commentsUserEmail`
48+
* `commentsYear`
49+
50+
### Multicase properties
51+
52+
* For all placehoders two versions with `Uppercase first` and `lowercase` are created. That means, that for every praceholder there will be 2 created:
53+
54+
* **v**endorname = **c**ompanyexample
55+
* **V**endorname = **C**ompanyexample
56+
57+
* **m**odulename = **e**xamplemodule
58+
* **M**odulename = **E**xamplemodule
59+
60+
* **c**ustomparam = **s**omevalue
61+
* **C**ustomparam = **S**omevalue
62+
63+
* Thanks to that, the user needs to enter only 1 value but 2 different placeholders can be used on the templates.

docs/privateTemplates.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Create own Templates just for you
2+
3+
Do the same as in the Create Templates documentation but place your template into `privateTemplates` folder.
4+
5+
* [How to create templates](createTemplates.md)
6+
7+
## Priority
8+
9+
Private templates have the highest priority. That means, that if you create a template with same name as an exiting one, your private will be used.

0 commit comments

Comments
 (0)