Skip to content

tools,doc: fix version picker in docs to show all available versions

Rodrigo Muino Tomonari requested to merge github/fork/Trott/version-picker into master

Quickly slapped-together proof-of-concept but I want feedback on the general idea/approach, so here's a draft PR.

Current situation is that we hard code the version picker into the docs at build time. This results in a confusing user experience described (partially--there are other oddities not described in there, I think) in https://github.com/nodejs/node/issues/32077.

This change moves the version picker into a separate JS file that is one directory above the docs so all versions of the docs can share. Since older versions (say, version 10.x) are smart enough to detect newer relevant releases (say, version 14.x) at build time, these JS files will always be up to date.

TODO:

  • Confirm that these one-directory-up files will be moved to the web server on release. If not, then we need to add that to the release job/process.
  • Replace document.write() and render-blocking <script> tag with a non-blocking approach

@codebytere @richardlau @rvagg @nschonni @XhmikosR @alexandrtovmach

To test locally: make doc-only and then open out/doc/api/index.html in a web browser. (The resulting HTML files will work offline. No need to spin up a web server. Or at least that's my experience on macOS.)

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Merge request reports

Loading