Skip to content

Commit

Permalink
fixed package file
Browse files Browse the repository at this point in the history
  • Loading branch information
uma-kt committed Nov 4, 2024
2 parents 7097acf + 9a5f758 commit 0a04faf
Show file tree
Hide file tree
Showing 25 changed files with 1,341 additions and 34 deletions.
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.
87 changes: 58 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"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.5.0",
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 0a04faf

Please sign in to comment.