Skip to content

Commit

Permalink
package: upgrade vitepress-sidebar package
Browse files Browse the repository at this point in the history
  • Loading branch information
jooy2 committed Nov 1, 2024
1 parent d2cc88d commit 35600fe
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
16 changes: 8 additions & 8 deletions docs/package-lock.json

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

4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"author": "jooy2 <[email protected]>",
"license": "MIT",
"dependencies": {
"vitepress": "^1.4.2",
"vitepress": "^1.4.3",
"vitepress-i18n": "^1.3.0",
"vitepress-sidebar": "^1.28.0",
"vitepress-sidebar": "^1.29.0",
"vue": "^3.5.12"
}
}
27 changes: 15 additions & 12 deletions docs/src/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig, UserConfig } from 'vitepress';
import { generateSidebar, VitePressSidebarOptions } from 'vitepress-sidebar';
import { withSidebar, VitePressSidebarOptions } from 'vitepress-sidebar';
import { name, homepage } from '../../../package.json';
import { withI18n } from 'vitepress-i18n';
import { VitePressI18nOptions } from 'vitepress-i18n/dist/types';
Expand All @@ -23,6 +23,17 @@ const commonSidebarConfig: VitePressSidebarOptions = {
sortMenusByFrontmatterOrder: true
};

const vitePressSidebarConfigs: VitePressSidebarOptions[] = [
...[defaultLocale, 'ko'].map((lang) => {
return {
...commonSidebarConfig,
documentRootPath: `/src/${lang}`,
resolvePath: defaultLocale === lang ? '/' : `/${lang}/`,
...(defaultLocale === lang ? {} : { basePath: `/${lang}/` })
};
})
];

const vitePressI18nConfigs: VitePressI18nOptions = {
locales: [defaultLocale, 'ko'],
rootLocale: defaultLocale,
Expand Down Expand Up @@ -89,21 +100,13 @@ const vitePressConfigs: UserConfig = {
editLink: {
pattern: 'https://github.com/jooy2/qsu/edit/master/docs/src/:path'
},
sidebar: generateSidebar([
...[defaultLocale, 'ko'].map((lang) => {
return {
...commonSidebarConfig,
documentRootPath: `/src/${lang}`,
resolvePath: defaultLocale === lang ? '/' : `/${lang}/`,
...(defaultLocale === lang ? {} : { basePath: `/${lang}/` })
};
})
]),
footer: {
message: 'Released under the MIT License',
copyright: '© <a href="https://cdget.com">CDGet</a>'
}
}
};

export default defineConfig(withI18n(vitePressConfigs, vitePressI18nConfigs));
export default defineConfig(
withSidebar(withI18n(vitePressConfigs, vitePressI18nConfigs), vitePressSidebarConfigs)
);

0 comments on commit 35600fe

Please sign in to comment.