utils/release.py/update_custom_js
def update_custom_js(version, patch=False):
    """Update the version table in the custom.js file."""
    with open(CUSTOM_JS_FILE, "r", encoding="utf-8", newline="\n") as f:
        lines = f.readlines()
    index = 0

    # First let's put the right version
    while not lines[index].startswith("const stableVersion ="):
        index += 1
    lines[index] = f'const stableVersion = "v{version}"\n'

    # Then update the dictionary
    while not lines[index].startswith("const versionMapping = {"):
        index += 1

    # We go until the end
    while not lines[index].startswith("}"):
        search = re.search(r'^(\s+)"": "([^"]+) \(stable\)",\s*\n$', lines[index])
        if search is not None:
            indent, old_versions = search.groups()
            if patch:
                # We add the patch to the current stable doc
                old_versions = f"{old_versions}/v{version}"
                lines[index] = f'{indent}"": "{old_versions} (stable)",\n'
            else:
                # We only keep the last of the micro versions associated to that particular release
                old_version = old_versions.split("/")[-1]
                lines[index] = f'{indent}"": "v{version} (stable)",\n{indent}"{old_version}": "{old_versions}",\n'
        index += 1

    with open(CUSTOM_JS_FILE, "w", encoding="utf-8", newline="\n") as f:
        lines = f.writelines(lines)