Skip to content

Latest commit

 

History

History
59 lines (37 loc) · 2.41 KB

contributing.md

File metadata and controls

59 lines (37 loc) · 2.41 KB

Contributing to go-watermill-template

First of all, thank you 🙇🏾‍♀️ for considering contributing to go-watermill-template; it needs all the help it can get!

This contribution guide is an extension to the core contributing guide that can be found here. Please make sure you go through that beforehand. 🙂👍🏽

Design

This repo was created from the template repo template-for-generator-templates

It has borrowed most of its concepts from it

Also check out this intial video where some of the concepts about a generator are discussed.

This generator has 2 main concepts

  1. template
  2. components

Generated Code

The code generated by this template has the following structure

  • asyncapi
    • handlers.go
    • payloads.go
    • publishers.go
    • router.go
    • server.go
    • subscribers.go
  • go.mod
  • go.sum
  • main.go

For each of the above files genenrated there should be a corresponding .js file under the templates direectory. These template files parse take the parsed asyncapi doc as an input and then delegate to the responsibility of generating code to the react components under the components directory

Development

It is not easy to write code in one language to generate code in another language. In this case code is being written in js to generate go code. Hence the best way to develop is to first develop the go code that one intends to generate. One may consider this repo for example where the working go code is first developed and is used as reference to author the above templates

Dev Testing

In order to dev test the generated code consider running the npm command

npm run dev

This generates go code to the dir output based on the asyncapi sample file here

Once the go code is generated, one can navigate to the output directory and run go run main.go to test the generated code. Importantly one must have the appropriate broker or messaging software running locally to be able to test it successfully