Skip to content

docs(site): make version injection generic (versions.json-driven) - #22067

Merged
yperbasis merged 1 commit into
mainfrom
docs/generic-version-injection-main
Jun 29, 2026
Merged

docs(site): make version injection generic (versions.json-driven)#22067
yperbasis merged 1 commit into
mainfrom
docs/generic-version-injection-main

Conversation

@bloxster

Copy link
Copy Markdown
Collaborator

Forward-ports the generic version-injection refactor (introduced on release/3.5 in #22062) to main, so every release branch cut from main inherits it.

Why on main

Release branches are cut from main. If this infra only lived on release/3.5, release/3.6 would revert to the old hardcoded per-series resolver. Pairs with the Docs Version Bump workflow (#22066), which also lives on main.

What changes

  • Replaces the hardcoded fetchLatestV33Version / v33Version with a parametrized fetchLatestSeriesVersion(prefix) looped over versions.json, building a {id -> latest patch} map.
  • The remark plugin routes by the version-vX.Y path segment instead of a hardcoded version-v3.3 check.
  • Net effect: adding an archived version (via docusaurus docs:version) needs zero edits to docusaurus.config.ts or version-replace.js.

No behavior change here

versions.json is still ["v3.3"] and the current label is still v3.4 — verified the build injects 3.3.1 into the v3.3 archive and the latest release into current, exactly as before. This PR is purely the mechanism.

🤖 Generated with Claude Code

Forward-port of the generic version-injection introduced on release/3.5
(#22062). Replaces the hardcoded per-series resolver (v33Version) with a
single loop over versions.json: the config fetches the latest patch release
for each archived version and passes a {id -> versionString} map to the
remark plugin, which routes by the `version-vX.Y` path segment.

Net effect: adding a new archived version (via `docusaurus docs:version`)
needs NO edits to docusaurus.config.ts or version-replace.js. This belongs on
main so every release branch cut from main inherits it (pairs with the Docs
Version Bump workflow, #22066). Behaviour is unchanged here: versions.json is
still ["v3.3"], current label still v3.4.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR forward-ports the docs-site “generic version injection” mechanism to main, so archived docs versions (from versions.json) automatically receive the correct {ERIGON_VERSION} replacement without adding per-series configuration.

Changes:

  • Replaces the hardcoded archived-series resolver with a generic fetchLatestSeriesVersion(prefix) approach driven by versions.json.
  • Updates the remark plugin to detect archived versions via the version-vX.Y path segment and select the corresponding injected version string.
  • Passes a { archivedVersionId -> latestPatchString } map (versionStrings) into the remark plugin from docusaurus.config.ts.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
docs/site/src/remark/version-replace.js Switches archive detection from a hardcoded version-v3.3 check to generic version-* segment routing via versionStrings.
docs/site/docusaurus.config.ts Derives archived version injection values from versions.json and passes them into the remark plugin.
Comments suppressed due to low confidence (1)

docs/site/docusaurus.config.ts:36

  • fetchLatestSeriesVersion() fetches the full releases list for each archived version, which scales linearly with the number of archives and increases the chance of GitHub API rate-limiting during docs builds. It also limits the search to per_page=50, which can fail to find older series if they fall outside the first page. Consider fetching releases once (with per_page=100) and deriving all archived series versions from that single response.
async function fetchLatestSeriesVersion(prefix: string): Promise<string> {
  try {
    const res = await fetch(
      'https://api.github.com/repos/erigontech/erigon/releases?per_page=50',
      {headers: githubHeaders()},

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yperbasis yperbasis added the docs label Jun 29, 2026
@yperbasis
yperbasis added this pull request to the merge queue Jun 29, 2026
Merged via the queue into main with commit 10a37bd Jun 29, 2026
22 checks passed
@yperbasis
yperbasis deleted the docs/generic-version-injection-main branch June 29, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants