Uh oh!
There was an error while loading. Please reload this page.
tools: build all.json by combining generated JSON - #21637
Conversation
rubys
commented
Jul 3, 2018
See #21568 (comment) for the original request. |
Trott
commented
Jul 3, 2018
Not sure if @tolmasky or any of their RunKit colleagues will be able to test this ahead of time, but pinging anyway as their the one significant consumer of our docs-in-JSON-format that I'm aware of. (I don't know if this would help or not, but maybe it would help them if the resulting JSON could be stashed somewhere, maybe in a gist or something.) |
vsemozhetbyt
commented
Jul 3, 2018
What will happen with https://github.com/nodejs/node/blob/master/doc/api/index.md? It also contains one include directive. |
rubys
commented
Jul 3, 2018
@Trott@tolmaskygist containing both what all.json will look like after this change, and a diff between what it looks like after vs what it looked like before. @vsemozhetbyt good catch! Initial thoughts: _toc.md should be renamed to _index.md (overwriting this file). allhtml.js and alljson.js would need to be updated to read this data from its new location. If you agree, I'll make this change and squash the commit. |
Seems good, but we should also check mentions like this one: Line 39 in 6e16ad7 |
95ad110 to
511f403Comparevsemozhetbyt
commented
Jul 3, 2018
I hope I will be able to review at the weekend. If anybody feels confident to review and land sooner please do) |
Me1000
commented
Jul 3, 2018
Hey all! I work on the RunKit team, thanks for the ping @Trott. The new output looks like it contains all the existing data. If that is indeed the case (the output is quite large, so maybe I missed something) then it should be fairly easy for us consume the new format. :) |
One breaking change in the |
There was a problem hiding this comment.
It seems the parentheses are redundant now.
There was a problem hiding this comment.
- initialize -> Initialize.
- Extra space between the sentences.
There was a problem hiding this comment.
.replace('.html', '.json') seems erroneous here?
There was a problem hiding this comment.
It seems this should be /<a href=\\"#/g, `<a href=\\"${href}#`, as double quotes are escaped in .json sources.
There was a problem hiding this comment.
Sorry, it seems this line also need to be updated so that the new HTML comment from index.md could be excluded from all the docs except the index.html.
There was a problem hiding this comment.
I mean the .replace(/^@\/\/.*$/gm, '') part.
There was a problem hiding this comment.
(Just to prevent doubts: dotAll flag is supported since V8 6.2, so this line is backportable for Node.js 8 LTS.)
There was a problem hiding this comment.
Just one more significant nit I've found while diffing the old and new results: new all.json lacks the \n at the end of the file, just after the last }. So maybe it is worth to replace JSON.stringify(results, null, 2) with `${JSON.stringify(results, null, 2)}\n` to be on the safe side)
vsemozhetbyt
commented
Jul 7, 2018
A note: amended commits are not reported to the people that are subscribed to a PR, so maybe it is worth to let everybody know about a new commit version by a comment) |
Notes: 1) Removed a number of root properties that did not seem relevant: source, desc, and introduced_in. There no longer is a source, and the other two are from the first include and do not reflect the entire API. 2) As with nodejs#20100, the current "desc" properties sometimes contained in-page links, other times referenced another page, and often did not match the links in the original HTML or JSON file. I chose to standardize on external links as "desc" values are isolated snippets as opposed to all.html which can be viewed as a standalone and self contained document. 3) Eliminated preprocessing for @include entirely, including the test case for this function. 4) _toc.md was renamed to index.md. 5) index comments no longer appear in embedded TOCs (left hand side column in the generated documentation.
rubys
commented
Jul 7, 2018
Perhaps I should just stop squashing commits. |
vsemozhetbyt
commented
Jul 7, 2018
vsemozhetbyt
commented
Jul 7, 2018
Let's land this on Monday, maybe somebody from @nodejs/documentation will want to chime in. |
Notes: 1) Removed a number of root properties that did not seem relevant: source, desc, and introduced_in. There no longer is a source, and the other two are from the first include and do not reflect the entire API. 2) As with #20100, the current "desc" properties sometimes contained in-page links, other times referenced another page, and often did not match the links in the original HTML or JSON file. I chose to standardize on external links as "desc" values are isolated snippets as opposed to all.html which can be viewed as a standalone and self contained document. 3) Eliminated preprocessing for @include entirely, including the test case for this function. 4) _toc.md was renamed to index.md. 5) index comments no longer appear in embedded TOCs (left hand side column in the generated documentation. PR-URL: #21637 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
vsemozhetbyt
commented
Jul 9, 2018
Landed in 0c743b5 |
Notes: 1) Removed a number of root properties that did not seem relevant: source, desc, and introduced_in. There no longer is a source, and the other two are from the first include and do not reflect the entire API. 2) As with #20100, the current "desc" properties sometimes contained in-page links, other times referenced another page, and often did not match the links in the original HTML or JSON file. I chose to standardize on external links as "desc" values are isolated snippets as opposed to all.html which can be viewed as a standalone and self contained document. 3) Eliminated preprocessing for @include entirely, including the test case for this function. 4) _toc.md was renamed to index.md. 5) index comments no longer appear in embedded TOCs (left hand side column in the generated documentation. PR-URL: #21637 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>

Notes:
Removed a number of root properties that did not seem relevant: source,
desc, and introduced_in. There no longer is a source, and the other two are
from the first include and do not reflect the entire API.
As with doc: all.html is seriously broken link-wise #20100, the current "desc"
properties sometimes contained in-page links, other times referenced another
page, and often did not match the links in the original HTML or JSON file.
I chose to standardize on external links as "desc" values are isolated
snippets as opposed to all.html which can be viewed as a standalone and self
contained document.
Eliminated preprocessing for @include entirely, including the test case
for this function.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes