-
Notifications
You must be signed in to change notification settings - Fork 359
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
use handlebars for code generation #2228
Conversation
Thanks for this. It is def an avenue worth exploring. Most probably will not get to having an proper look today (don't want to skimp over it and want to do it properly) |
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.
I agree with your initial assessment that the templates may be a bit tougher (although editors should have .hbs
helpers, obv. being non-HTML is not perfect), however it does remove a lot of absolutely horrible code that is also duplicated in each generator.
I do think this is an overall win, even if the remaining code is still not stunningly pretty.
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.
lgtm.
(In this case the generated output being added makes a lot of sense, can see they match 100%... well, apart from the comments being much nicer now)
@@ -51,6 +51,7 @@ declare module '@polkadot/metadata/Decorated/consts/types' { | |||
/** | |||
* The amount of funds a contract should deposit in order to offset | |||
* the cost of one byte. | |||
* |
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.
Def much better, also in the editor. Thank you.
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Convert typegen code to use handlebars syntax.
The result is almost identical except for empty lines are preserved in doc comments.
fromChain
is not updated as I can't find an easy way to rundocs/examples/promise/90_typegen
to compare output. Can do it in later PR.