This is an automated email from the ASF dual-hosted git repository. jark pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/fluss.git
commit 5f304f2a4e0fe9e26b5e03d85875537ad32709af Author: Jark Wu <[email protected]> AuthorDate: Sun Oct 26 11:01:57 2025 +0800 [docs] Add labels to versions under releasing --- website/docusaurus.config.ts | 12 ++++++--- website/src/utils/versionData.ts | 53 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 4 deletions(-) diff --git a/website/docusaurus.config.ts b/website/docusaurus.config.ts index 08c66381d..0965ee014 100644 --- a/website/docusaurus.config.ts +++ b/website/docusaurus.config.ts @@ -19,6 +19,8 @@ import {themes as prismThemes} from 'prism-react-renderer'; import type {Config} from '@docusaurus/types'; import type * as Preset from '@docusaurus/preset-classic'; import versionReplace from './src/plugins/remark-version-replace/index'; +import { loadVersionData } from './src/utils/versionData'; +const { versionsMap, latestVersion } = loadVersionData(); const config: Config = { title: 'Apache Fluss™ (Incubating)', @@ -56,10 +58,12 @@ const config: Config = { 'classic', { docs: { - sidebarPath: './sidebars.ts', - editUrl: ({docPath}) => - `https://github.com/apache/fluss/edit/main/website/docs/${docPath}`, - remarkPlugins: [versionReplace], + sidebarPath: './sidebars.ts', + editUrl: ({docPath}) => + `https://github.com/apache/fluss/edit/main/website/docs/${docPath}`, + remarkPlugins: [versionReplace], + lastVersion: latestVersion, + versions: versionsMap }, blog: { showReadingTime: false, diff --git a/website/src/utils/versionData.ts b/website/src/utils/versionData.ts new file mode 100644 index 000000000..cfb447bfb --- /dev/null +++ b/website/src/utils/versionData.ts @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const pathToFluss = '../../fluss-versions.json'; +const pathToVersions = '../../versions.json'; + +export function loadVersionData(): { versionsMap: Record<string, any>, latestVersion: string} { + const fluss_versions: Array<any> = require(pathToFluss); + const flussVersionMap = new Map<string, any>(); + fluss_versions.forEach((v) => { + flussVersionMap.set(v.shortVersion, v.released); + }); + + let versions: Array<string> = []; + try { + versions = require(pathToVersions); + } catch (e) { + versions = []; + } + + let latestVersion: string = 'current'; + const versionsMap: Record<string, any> = Object.fromEntries([ + ['current', { label: 'Next', path: 'next', banner: 'unreleased' }], + ...versions.map((item: string) => { + if (flussVersionMap.get(item)) { + if (latestVersion === 'current') { + latestVersion = item; + return [item, { label: item, banner: 'none' }]; + } else { + return [item, { label: item, path: item, banner: 'unmaintained' }]; + } + } else { + return [item, { label: item + ' 🚧', path: item, banner: 'unreleased' }]; + } + }), + ]); + + return {versionsMap, latestVersion}; +} \ No newline at end of file
