-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
webrpc-gen CLI v2: Templates API v0.7.0 (#119)
* Exploring Templates functions API * Implement "dict", "set" and "get" dictionary funcs for templates This will help us define type mapping in templates * Re-add some v0.6.0 functions for now * Refactor dict function, so we can pass it down to sub-templates * Add type helper funcmaps * Implement isBaseType function * Bring back some obsolete functions to keep generators v0.6.0 working * make diff * Fix the tests for now * Fix go.mod after git cherry-pick * Pass variables to templates via CLI -Flags, add error/fatal funcmaps * Remove gofmt/goimports for now * Implement printfStderr and exit funcs * Move VERSION to gen/ package, expose it as {{.WebrpcGenVersion}} * Expose {{.WebrpcTarget}} and {{.WebrpcGenCLI}} * Remove generator specific tests Each generator repo should be testing the schema/output on its own * Improve and document the template variables * Support old -client, -server and -pkg flags * Remove bunch of golang-specific funcmaps * Fix tests * Remove go-specific funcmaps for method inputs/outputs/arguments * Resolve rebase * Print "custom" target in case of local dir * Remove more go-specific funcmaps; rename "first" to "coalesce" * Gen: Remove all Go-spefific funcmaps/code * Remove last go-specific funcmaps * README: Table of generators * Remove "indent" and rename "stderrPrintf" * webrpc-gen: Return early when writing to stdout * webrpc-gen: Print fatal errors to stderr Otherwise the errors potentially ended up in the generated output file. * Execute "main" template as the required generator entrypoint * Add documentation about generator templates * Generator docs: Document schema object and add TOC * Document template functions * Implement minVersion function * Markdown: Escape column character in a table row * Document requiring webrpc-gen version from templates * Improve error message by naming the template after its target * Collect flags in its own function * Implement "default" function * Add "in" function, remove "str" function and gofmt * Implement ternary, split, first, last functions * Remove JavaScript-specific template functions * Finalize template functions for webrpc schema types * Remove last generic or TS-specific template functions * Update template functions docs * Update README & examples with new webrpc-gen targets * Bring back goimport/gofmt for golang targets * PR feedback: Use Go 1.16+ * webrpc-gen CLI: Use v0.7.0 as an example target * Use os.WriteFile() instead of ioutil.WriteFile() * Improve isGolangTarget() so it works with local templates too * webrpc-gen -fmt=false: disable automatic code formatting * Lowercase all template option CLI flags, print target -help * Lowercase all generator options, update docs * Regenerate examples: Apply new DO NOT EDIT comment
- Loading branch information
1 parent
dad76e4
commit 9422d22
Showing
44 changed files
with
983 additions
and
1,336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.