Skip to content

Commit

Permalink
Merge branch 'master' into snyk-fix-183152281d2b39b416c82314af7227c9
Browse files Browse the repository at this point in the history
  • Loading branch information
uma-kt authored Nov 4, 2024
2 parents 66d6c6d + b496330 commit d7ff1a8
Show file tree
Hide file tree
Showing 26 changed files with 4,974 additions and 234 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM node:18.20.0-alpine as builder

FROM node:18.20.4-alpine as builder
WORKDIR /build
COPY . ./
COPY ./images/ ./static/images
Expand Down
27 changes: 26 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
// Note: type annotations allow type checking and IDEs autocompletion

const { themes } = require('prism-react-renderer');
const data = require("./versioned_sidebars/version-1.3.0-sidebars.json");
import version from './versions.json'
import { getValidPaths } from './utils.js';


const lightCodeTheme = themes.github;
const darkCodeTheme = themes.dracula;

const validPaths = getValidPaths(data?.version3);
const latestVersion =version[0];

/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Avesha Docs',
Expand Down Expand Up @@ -160,7 +168,24 @@ const config = {
{
id: 'GTM-N7K6NGB', // GTM Container ID
}
]
],
[
"@docusaurus/plugin-client-redirects",
{
fromExtensions: ["html", "htm"],
toExtensions: ["exe", "zip"],
redirects: validPaths?.map((path) => ({
from: `/latest/${path}`,
to: `/${latestVersion}/${path}`,
})),
createRedirects(existingPath) {
if (existingPath.includes("/latest")) {
return [existingPath.replace("/latest", `/${latestVersion}`)];
}
return undefined;
},
},
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3,915 changes: 3,688 additions & 227 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
},
"dependencies": {
"@docusaurus/core": "3.4.0",
"@docusaurus/plugin-client-redirects": "^3.4.0",
"@docusaurus/plugin-content-blog": "^3.4.0",
"@docusaurus/plugin-google-gtag": "^3.4.0",
"@docusaurus/preset-classic": "3.4.0",
"@docusaurus/preset-classic": "3.5.0",
"@mdx-js/react": "^3.0.0",
"clsx": "^2.1.1",
"docusaurus-gtm-plugin": "^0.0.2",
Expand All @@ -28,7 +29,7 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^3.4.0",
"@docusaurus/module-type-aliases": "^3.4.0",
"sass": "^1.69.5"
},
"browserslist": {
Expand Down
2 changes: 1 addition & 1 deletion prod.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16.14.0-alpine3.15 as builder
FROM node:18.2.0-alpine as builder
WORKDIR /build
COPY package.json ./
COPY package-lock.json ./
Expand Down
31 changes: 31 additions & 0 deletions utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
function uniquePath(path) {
const segments = path?.split("/").filter(Boolean);
for (let i = 0; i < segments.length; i++) {
if (segments.length === 2 && segments[i] === segments[i + 1]) {
return segments[0] + "/";
}
}
return path;
}


export function getValidPaths(items) {
return items?.flatMap((item) => {
const paths = [];

if (item?.label) {
if (item.label !== "Overview") {
const formattedTitle = `category/${item?.label.toLowerCase().replace(/\s+/g, "-")}`;
paths.push(formattedTitle);
}
}

if (item?.items) {
paths.push(...getValidPaths(item?.items));
} else if (typeof item === "string") {
paths.push(uniquePath(item));
}

return paths;
});
}
Loading

0 comments on commit d7ff1a8

Please sign in to comment.