Skip to content

Commit 51109b6

Browse files
authored
Merge pull request #20 from nakrovati/refactor/website
Refactor/website
2 parents 25c7bd2 + 65a575a commit 51109b6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+3635
-1245
lines changed

.editorconfig

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,12 @@ root = true
44
[*]
55
charset = utf-8
66
end_of_line = lf
7-
insert_final_newline = true
8-
trim_trailing_whitespace = true
97
indent_style = space
10-
tab_width = 4
8+
indent_size = 2
119
max_line_length = off
12-
13-
[*.{js,ts,vue,css,json,jsonc,yml,yaml}]
14-
tab_width = 2
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
1512

1613
[*.md]
17-
tab_width = 2
1814
max_line_length = off
19-
trim_trailing_whitespace = false
15+
trim_trailing_whitespace = false

.github/workflows/deploy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout 🛎️
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v5
1919

2020
- name: Setup Node
21-
uses: actions/setup-node@v4
21+
uses: actions/setup-node@v6
2222
with:
23-
node-version: 22
23+
node-version: 24
2424
cache: npm
2525

2626
- name: Install dependencies

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,5 @@ yarn-error.log*
1717
.zed/
1818
.vscode/
1919

20-
release.data.json
21-
changelogs.data.json
22-
2320
yarn.lock
2421
pnpm-lock.yaml

.markdownlintignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
node_modules
1+
node_modules
2+
.vitepress/cache
3+
.vitepress/dist

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
package-lock.json
2-
pnpm-lock.yaml
2+
pnpm-lock.yaml

.vitepress/config/en.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type { DefaultTheme, LocaleConfig } from "vitepress";
2-
import type { CustomConfig, Theme } from "../theme/types";
2+
3+
import type { CustomConfig, ThemeConfig } from "../theme/types";
4+
35
import { sections } from "../theme/plugins/section";
46
import { resolveBaseUrl } from "../theme/utils";
57

@@ -31,7 +33,7 @@ export const searchLocale: Record<string, Partial<Omit<DefaultTheme.LocalSearchO
3133
},
3234
};
3335

34-
export const config: LocaleConfig<Theme.Config> = {
36+
export const config: LocaleConfig<ThemeConfig> = {
3537
root: {
3638
label: "English",
3739
lang: "en",

.vitepress/config/hooks/generateMeta.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { HeadConfig, TransformContext } from "vitepress";
2+
23
import type { DocsPageData } from "../../theme/plugins/section";
34

45
function generateMeta(context: TransformContext, hostname: string) {

.vitepress/config/hooks/generateOgImages.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import type { ContentData, SiteConfig } from "vitepress";
2+
3+
import { renderAsync } from "@resvg/resvg-js";
14
import { mkdir, readFile, writeFile } from "node:fs/promises";
25
import { dirname, resolve } from "node:path";
36
import { fileURLToPath } from "node:url";
47
import { createContentLoader } from "vitepress";
5-
import type { ContentData, SiteConfig } from "vitepress";
68
import { type SatoriOptions, satoriVue } from "x-satori/vue";
7-
import { renderAsync } from "@resvg/resvg-js";
89

910
const __dirname = dirname(fileURLToPath(import.meta.url));
1011
const __fonts = resolve(__dirname, "../../fonts");
@@ -55,7 +56,7 @@ interface GenerateImagesOptions {
5556
fonts: SatoriOptions["fonts"];
5657
}
5758

58-
type Dirs = "FAQ" | "Guide" | "News" | "Sandbox" | "Dev" | "Other";
59+
type Dirs = "Dev" | "FAQ" | "Guide" | "News" | "Other" | "Sandbox";
5960

6061
function getDir(url: string): Dirs {
6162
if (url.startsWith("/manuals/faq/")) {

.vitepress/config/index.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
1-
import type { Theme } from "../theme/types";
2-
import { defineConfigWithTheme } from "vitepress";
3-
import { config as root, searchLocale as searchLocaleEn } from "./en";
4-
import { addPlugins } from "../theme/plugins/markdown";
5-
import { sections, prepareData } from "../theme/plugins/section";
6-
import { slugify } from "transliteration";
1+
// @ts-expect-error Missing types
2+
import shortcode_plugin from "markdown-it-shortcode-tag";
73
import { fileURLToPath, URL } from "node:url";
8-
import { telegram } from "../../website/icons";
4+
import { slugify } from "transliteration";
5+
import { defineConfigWithTheme } from "vitepress";
96
import { tabsMarkdownPlugin } from "vitepress-plugin-tabs";
10-
import shortcode_plugin from "markdown-it-shortcode-tag";
11-
import shortcodes from "./shortcodes";
12-
import generateOgImages from "./hooks/generateOgImages";
7+
8+
import type { ThemeConfig } from "../theme/types";
9+
10+
import { telegram } from "../../website/icons";
11+
import { addPlugins } from "../theme/plugins/markdown";
12+
import { prepareData, sections } from "../theme/plugins/section";
13+
import { config as root, searchLocale as searchLocaleEn } from "./en";
1314
import generateMeta from "./hooks/generateMeta";
15+
import generateOgImages from "./hooks/generateOgImages";
16+
import shortcodes from "./shortcodes";
1417

1518
const SITE_HOST = "https://kotatsu.app";
1619
const SITE_TITLE = "kotatsu.app";
1720
const SITE_TITLE_SEPARATOR = " / ";
1821

19-
export default defineConfigWithTheme<Theme.Config>({
22+
export default defineConfigWithTheme<ThemeConfig>({
2023
lastUpdated: true,
2124
cleanUrls: true,
2225

@@ -36,8 +39,8 @@ export default defineConfigWithTheme<Theme.Config>({
3639
.trim()
3740
.replace(/^\d*/g, "") // Удаление чисел из начала строки
3841
.replace(/[^a-zA-Zа-яА-ЯЁё0-9\-\s]/g, "") // Удаление ненужных символов
39-
.replace(/\s\-\s/, "-")
40-
.replace(/\-+/g, "-") // Избавление от повторяющихся символов
42+
.replace(/\s-\s/, "-")
43+
.replace(/-+/g, "-") // Избавление от повторяющихся символов
4144
.replace(/^(.{25}[^\s]*).*/, "$1"); // Ограничение количества символов
4245

4346
return encodeURIComponent(slugify(str, { lowercase: true }));
@@ -102,7 +105,7 @@ export default defineConfigWithTheme<Theme.Config>({
102105
vite: {
103106
resolve: {
104107
alias: ["VPSidebar", "VPNavBarTranslations", "VPNavScreenTranslations", "VPNavBar", "VPNavBarMenu", "VPNavScreenMenu", "VPFooter"].map((componentName) => ({
105-
find: new RegExp(`^.*\/${componentName}\.vue$`),
108+
find: new RegExp(`^.*/${componentName}.vue$`),
106109
replacement: fileURLToPath(new URL(`../theme/components/${componentName.replace(/^VP/, "")}.vue`, import.meta.url)),
107110
})),
108111
},

.vitepress/theme/components/Breadcrumbs.vue renamed to .vitepress/theme/components/BaseBreadcrumbs.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<script setup lang="ts">
22
import type { Ref } from "vue";
3-
import { useData, withBase, useRoute } from "vitepress";
4-
import type { DocsPageData } from "../plugins/section";
53
4+
import { useData, useRoute, withBase } from "vitepress";
65
import VPLink from "vitepress/dist/client/theme-default/components/VPLink.vue";
76
7+
import type { DocsPageData } from "../plugins/section";
8+
89
const { page }: { page: Ref<DocsPageData> } = useData();
910
const route = useRoute();
1011
</script>

0 commit comments

Comments
 (0)