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
+30-2Lines changed: 30 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,10 +22,10 @@ The best way then to use this is to add an alias, then you can use the CLI as if
22
22
## Usage
23
23
24
24
1) To create a project run `commit0 create [PROJECT_NAME]`
25
-
2) A folder will be created and within that update the `commit0.yml` and then run `commit0 generate`
25
+
2) A folder will be created and within that update the `commit0.yml` and then run `commit0 generate -c <commit0.yml>`
26
26
3) You will see that there is now an idl folder created.
27
27
4) Within the idl folder modify the the protobuf services generated with your desired methods
28
-
5) Go up to the parent directory and re run `commit0 generate -l=[LANGUAGE OF CHOICE]`
28
+
5) Go up to the parent directory and re run `commit0 generate -c <commit0.yml>`
29
29
6) You will now see a `server` folder navigate to your service folder within that directory and implement the methods generated for it
30
30
7) Once you have tested your implementation and are happy with it return to the idl repo push that directory up to git
31
31
8) Return to the parent directory and check the depency file, for go it will be the go.mod file remove the lines that point it to your local directory, this will now point it to the version on git that was pushed up previously
@@ -66,13 +66,41 @@ this will create a commit0 executable in your working direcory. To install insta
66
66
make install-go
67
67
```
68
68
69
+
Compile a new `commit0` binary in the working directory
70
+
```
71
+
make build
72
+
```
73
+
74
+
Now you can either add your project directory to your path or just execute it directly
75
+
```
76
+
mkdir tmp
77
+
cd tmp
78
+
../commit0 create test-app
79
+
cd test-app
80
+
../../commit0 generate -c commit0.yml
81
+
```
82
+
69
83
### Architecture
70
84
The project is built with GoLang and requires Docker
71
85
- /cmd - the CLI command entry points
72
86
- /internal/generate
73
87
- /internal/config
74
88
- /internal/templator - the templating service
75
89
90
+
Example Flow:
91
+
The application starts at `cmd/generate.go`
92
+
1. loads all the templates from packr
93
+
- TODO: eventually this should be loaded remotely throug a dependency management system
94
+
2. loads the config from the commit0.yml config file
95
+
3. based on the configs, run the appropriate generators
96
+
- templator is passed in to the Generate function for dependency injection
97
+
4. each generator (`react/generate.go`, `ci/generate.go` etc) further delegates and actually executes the templating based on the configs passed in.
98
+
-`internal/templator/templator.go` is the base class and includes generic templating handling logic
99
+
- it CI is required, it'll also call a CI generator and pass in the service specific CI configs
100
+
- TOOD: CI templates have to call separate templates based on the context
101
+
- TODO: templator should be generic and not have any knowledge of the specific templating implementation (go, ci etc), move that logic upstream
102
+
5. Depending on the config (`deploy == true` for certain) it'll also run the `Execute` function and actually deploy the infrastructure
103
+
76
104
### Building locally
77
105
78
106
As the templates are embeded into the binary you will need to ensure packr2 is installed.
0 commit comments