camunda / camunda-docs

Camunda 8 Documentation, including all components and features
https://docs.camunda.io/
Other
54 stars 181 forks source link

Feature request: run a single version locally #4344

Open pepopowitz opened 3 hours ago

pepopowitz commented 3 hours ago

Running the docs locally via npm start uses a lot of resources and takes a lot of time, sometimes resulting in crashes, and usually resulting in a frustrating experience.

Workaround

The local run can be scoped to only one pair of versions (one main docs instance, one Optimize instance), plus vNext, by making a few changes to configuration:

  1. Remove all other versions from the versions.json and optimize_versions.json.
    • Note that even if it seems like you do not want to serve an Optimize version, you still need to. There is logic that links main docs to Optimize docs and vice versa, and it requires both docs instances to exist.
  2. Remove all other versions from the versions definitions in the docusaurus.config.js
  3. Remove all other version pairs from the src/versions.js file.
  4. (Optional, if you're okay with the sidebar navigation not working) Remove hard-coded versions in the sidebars files

Feature request

We could add a script like npm run start:version 8.5, which would update the local environment to limit it to the specified version (as described in the workaround, and as demonstrated in our version archival scripts), then run the docs.

It should probably clean up any changes that it made, so that users don't accidentally commit them.

pepopowitz commented 2 hours ago

I got excited about this idea and started exploring it, but it became a can of worms and I had to stop. I also may have taken the wrong approach -- I forgot about the fact that we have all these scripts already for isolating a single version, and I ended up duplicating them in JavaScript instead of BASH.

I've captured everything I did at https://gist.github.com/pepopowitz/6139b8b8a54c0f15b59a9dfd3c025bb0. It does not yet handle the sidebar navigation -- it was at this point that I remembered the isolation scripts existed, and I became uncertain whether I preferred to (a) completely reinvent the wheel for all these scripts and have copies of them in both BASH and JavaScript, or (b) rewrite my start-single-version script to use JavaScript just for the ability to roll back changes when the server exits, and rewrite the BASH scripts so that I could consume only pieces of them.

At this point I'm still not sure which of those I prefer. I might even consider a third option -- use JavaScript for as many of these steps as possible, and update the isolateVersion scripts to consume them instead of the sed BASH scripts.