-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Extended JS interface -> Markdown generator #4275
Conversation
@@ -29,6 +29,8 @@ | |||
"build:app": "webpack --config webpack/app", | |||
"build:lib": "webpack --config webpack/libraries", | |||
"build:dll": "webpack --config webpack/vendor", | |||
"build:markdown": "babel-node ./src/jsonrpc/generator/build-markdown.js", |
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.
Probably not for this PR, but we should probably move the build-*.js
out into (maybe?) js/scripts
- it ended up being in there for no reason apart from the fact that we didn't want to lose code while combining the repos. (And as you've noticed was quite outdated and not being run)
Since it is building and not really source, it is a bit misleading atm.
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.
Kind of on the same accord - I reckon it would make sense to move the generated md files out from js/src/jsonrpc/docs
to js/docs
?
|
||
// Grabs JSON compatible | ||
function getExample (obj) { | ||
if (Array.isArray(obj)) { |
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.
Any reason to do const { isArray } = Array
above and then directly using Array.isArray
here? (Just feels slightly inconsistent in use)
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.
Just oversight.
} | ||
|
||
// Logging helpers | ||
function info (log) { console.log(chalk.blue(`INFO:\t${log}`)); } |
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.
Small comment, which would be more applicable to code not for the generator (i.e. these scripts I probably expect to always be a bit more messy - just the nature of the beast.) Would generally prefer even the simple functions to have the format of
function info (log) {
console.log(chalk.blue(`INFO:\t${log}`));
}
In addition blank line between. (non-critical here, nor a showstopper)
function warn (log) { console.warn(chalk.yellow(`WARN:\t${log}`)); } | ||
function error (log) { console.error(chalk.red(`ERROR:\t${log}`)); } | ||
|
||
const type2print = new WeakMap(); |
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.
Would probably make sense to move this definition (& init) to above the log functions, just so the variables are more-or-less in the same place.
Couple of small comments, non-critical, but it looks like it does what it says on the tin. |
Related to #2646 and #1905.
This PR contains mostly just the upgrades made to the markdown generator over time as I was adding missing methods, descriptions and examples to the js interfaces.