-
Notifications
You must be signed in to change notification settings - Fork 53
COMMIT0-57 api for generating project #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
84cb805 to
51a3d15
Compare
| case "POST": | ||
| decoder := json.NewDecoder(req.Body) | ||
| var projectConfig ProjectConfiguration | ||
| err := decoder.Decode(&projectConfig) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to add validation for post request
internal/api/create_project.go
Outdated
| templates := packr.New("templates", "../templates") | ||
| t := templator.NewTemplator(templates) | ||
|
|
||
| err := os.Chdir(projectConfig.ProjectName) //cd into project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cd into project
(could pass in project name to add to file path for each generate function)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah you shouldn't need to chdir..
internal/api/README.md
Outdated
|
|
||
| ## Usage | ||
| - To run: | ||
| `go run internal/api/generate_api.go internal/api/create_project.go` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change this to an argument to the binary. commit0 walkthrough or commit0 ui or something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do I do this? @bmonkman --ty!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah you would create a new file like cmd/ui.go which adds a new command
internal/generate/generate_helper.go
Outdated
| "sync" | ||
| ) | ||
|
|
||
| func GenerateArtifactsHelper(t *templator.Templator, cfg *config.Commit0Config) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shared func for both cmd / api generate
internal/api/create_project.go
Outdated
| if (err != nil) { | ||
| panic(err) | ||
| } | ||
| cfg := config.LoadConfig(util.ApiGeneratedYamlName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just keep calling this commit0.yaml?
internal/templator/templator.go
Outdated
| ProtoHealthTemplate: NewSingleFileTemplator(box, "proto/health_proto.tmpl"), | ||
| ProtoServiceTemplate: NewSingleFileTemplator(box, "proto/service_proto.tmpl"), | ||
| Go: NewGoTemplator(box), | ||
| ApiCommit0: NewSingleFileTemplator(box, "commit0/api_generated.tmpl"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The output of the ui process should just be a regular commit0.yaml using the same template
5073edb to
262df53
Compare
No description provided.