nimblehq / gin-templates

Our optimized Gin templates used in our projects
MIT License
12 stars 1 forks source link

RFC: Gin-templates generator #54

Closed hoangmirs closed 3 years ago

hoangmirs commented 3 years ago

Why

In our gin-template, we're letting users build a binary file (nimble-gin) then using it to create a new project. https://github.com/nimblehq/gin-templates#usage

The nimble-gin command is just on top of the cookiecutter. https://github.com/nimblehq/gin-templates/blob/develop/cmd/create.go#L34

But I found some issues when using it:

How about using the cookiecutter command directly?

$ cookiecutter https://github.com/nimblehq/gin-templates
# or
$ cookiecutter https://github.com/nimblehq/gin-templates --checkout branch-name

Who Benefits?

Gin developers

hoangmirs commented 3 years ago

I voted for cookiecutter. I think it's unnecessary to build a new command based on it as cookiecutter just provides a few options to generate a project from the template. I think we can consider building a command if we mainly generate the project with it, I mean using golang to generate project (copy files, insert text to file, ...)

olivierobert commented 3 years ago

@hoangmirs @gutakk The advantage I see with using nimble-gin is that when/if cookiecutter is dropped and replaced by a custom generator then the interface for end-users would not change. The command nimble-gin abstracts the fact that cookiecutter is used. Interfaces should remain the same while the implementation can change.

What about storing the built package (binary) in the repository so that it does not need to be built? Would that solve the issues? The binary could be built via the CI when merging to master for automation purposes 💭

gutakk commented 3 years ago

@olivierobert I got your point now. This can be done in the next release (after Nimble Growth). Maybe the simpler way is to add more steps about setting up the GOPATH to README.

What do you think @hoangmirs