Skip to content

Commit

Permalink
chore(website): multiple version api doc (#384)
Browse files Browse the repository at this point in the history
* chore: add multiple version api doc sample

* update api docs list

* unnecessary duplicated latest docs

Co-authored-by: Yonghui Lin <homura.dev@gmail.com>
  • Loading branch information
PainterPuppets and homura authored Aug 31, 2022
1 parent f244d81 commit dab3e09
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
5 changes: 4 additions & 1 deletion website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/dracula");
const versioningBranchs = require("./versioning-branches");

/** @type {import('@docusaurus/types').Config} */
const config = {
Expand Down Expand Up @@ -82,10 +83,12 @@ const config = {
},
// { to: "/blog", label: "Blog", position: "left" },
{
href: "/api/",
label: "API",
position: "left",
target: "_blank",
items: [
...versioningBranchs,
]
},
{
href: "https://github.com/nervosnetwork/lumos",
Expand Down
30 changes: 30 additions & 0 deletions website/versioning-branches.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// string or { branchName: string, label: string }
const branches = [
{
branchName: 'stable',
label: '0.18.0(latest)'
},
{
branchName: 'develop',
label: '0.19.x(next)'
}
];

const parseURL = (branchName) => branchName
.replaceAll("_", "")
.replaceAll(".", "")
.replaceAll("/", "-")

module.exports = branches.map(branch => (
typeof branch === 'string'
? {
href: `https://lumos-website-git-${parseURL(branch)}-cryptape.vercel.app/api/`,
label: branch,
target: "_blank",
}
: {
href: `https://lumos-website-git-${parseURL(branch.branchName)}-cryptape.vercel.app/api/`,
label: branch.label,
target: "_blank",
}
))

1 comment on commit dab3e09

@vercel
Copy link

@vercel vercel bot commented on dab3e09 Aug 31, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

lumos-website – ./

lumos-website.vercel.app
lumos-website-cryptape.vercel.app
lumos-website-git-develop-cryptape.vercel.app

Please sign in to comment.