diff --git a/.vscode/settings.json b/.vscode/settings.json index c26e64d1..2f1d2486 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,8 +1,8 @@ { "prettier.enable": true, "editor.codeActionsOnSave": { - "source.fixAll": true, - "source.organizeImports": false + "source.fixAll": "explicit", + "source.organizeImports": "never" }, "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" diff --git a/docusaurus.config.js b/docusaurus.config.js deleted file mode 100644 index 1e0d95a0..00000000 --- a/docusaurus.config.js +++ /dev/null @@ -1,270 +0,0 @@ -const { themes } = require('prism-react-renderer'); - -const path = require('path') -const beian = '闽ICP备2020017848号-2' -const beian1 = '闽公网安备35021102000847号' - -const announcementBarContent = `` - - -export default async function createConfigAsync() { - /** @type {import('@docusaurus/types').Config} */ - return { - title: '愧怍的小站', - url: 'https://kuizuo.cn', - baseUrl: '/', - favicon: 'img/favicon.ico', - organizationName: 'kuizuo', - projectName: 'blog', - tagline: '道阻且长,行则将至', - /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ - themeConfig: { - // announcementBar: { - // id: 'announcementBar-3', - // content: announcementBarContent, - // }, - metadata: [ - { - name: 'keywords', - content: '愧怍, kuizuo', - }, - { - name: 'keywords', - content: 'blog, javascript, typescript, node, react, vue, web', - }, - { - name: 'keywords', - content: '编程爱好者, Web开发者, 写过爬虫, 学过逆向, 现在主攻ts全栈', - }, - ], - docs: { - sidebar: { - hideable: true, - }, - }, - headTags: [ - { - tagName: 'meta', - attributes: { - name: 'description', - content: '愧怍的个人博客', - }, - }, - ], - navbar: { - logo: { - alt: '愧怍', - src: 'img/logo.webp', - srcDark: 'img/logo.webp', - }, - hideOnScroll: true, - items: [ - { - label: '博客', - position: 'right', - to: 'blog', - }, - { - label: '项目', - position: 'right', - to: 'project', - }, - { - label: '更多', - position: 'right', - items: [ - { label: '归档', to: 'blog/archive' }, - { label: '笔记', to: 'docs/skill' }, - { label: '资源', to: 'resource' }, - { label: '友链', to: 'friends' }, - { label: '工具推荐', to: 'docs/tools' }, - ], - }, - { - type: 'localeDropdown', - position: 'right', - }, - ], - }, - footer: { - style: 'dark', - links: [ - { - title: '学习', - items: [ - { label: '博客', to: 'blog' }, - { label: '归档', to: 'blog/archive' }, - { label: '技术笔记', to: 'docs/skill' }, - { label: '实战项目', to: 'project' }, - { label: '前端示例', to: 'https://example.kuizuo.cn' }, - ], - }, - { - title: '社交媒体', - items: [ - { label: '关于我', to: '/about' }, - { label: 'GitHub', href: 'https://github.com/kuizuo' }, - { label: 'Twitter', href: 'https://twitter.com/kuizuo' }, - { - label: '掘金', - href: 'https://juejin.cn/user/1565318510545901', - }, - { label: 'Discord', href: 'https://discord.gg/M8cVcjDxkz' }, - ], - }, - { - title: '更多', - items: [ - { label: '友链', position: 'right', to: 'friends' }, - { label: '导航', position: 'right', to: 'resource' }, - // { label: '我的站点', position: 'right', to: 'website' }, - { - html: ``, - }, - ], - }, - ], - copyright: ` -

${beian}

-

${beian1}

-

Copyright © 2020 - PRESENT 愧怍 Built with Docusaurus.

- `, - }, - algolia: { - appId: 'GV6YN1ODMO', - apiKey: '50303937b0e4630bec4a20a14e3b7872', - indexName: 'kuizuo', - }, - giscus: { - repo: 'kuizuo/blog', - repoId: 'MDEwOlJlcG9zaXRvcnkzOTc2MjU2MTI=', - category: 'General', - categoryId: 'DIC_kwDOF7NJDM4CPK95', - theme: 'light', - darkTheme: 'dark_dimmed', - }, - socials: { - github: 'https://github.com/kuizuo', - twitter: 'https://twitter.com/kuizuo', - juejin: 'https://juejin.cn/user/1565318510545901', - csdn: 'https://blog.csdn.net/kuizuo12', - qq: 'https://wpa.qq.com/msgrd?v=3&uin=911993023&site=qq', - zhihu: 'https://www.zhihu.com/people/kuizuo', - cloudmusic: 'https://music.163.com/#/user/home?id=1333010742', - email: 'mailto:hi@kuizuo.cn', - }, - prism: { - theme: themes.oneLight, - darkTheme: themes.oneDark, - additionalLanguages: ['bash', 'json', 'java', 'php', 'rust', 'toml'], - defaultLanguage: 'javascript', - magicComments: [ - { - className: 'theme-code-block-highlighted-line', - line: 'highlight-next-line', - block: { start: 'highlight-start', end: 'highlight-end' }, - }, - { - className: 'code-block-error-line', - line: 'This will error', - }, - ], - }, - tableOfContents: { - minHeadingLevel: 2, - maxHeadingLevel: 4, - }, - liveCodeBlock: { - playgroundPosition: 'top', - }, - zoom: { - selector: '.markdown :not(em) > img', - background: { - light: 'rgb(255, 255, 255)', - dark: 'rgb(50, 50, 50)', - }, - }, - }, - presets: [ - [ - '@docusaurus/preset-classic', - { - docs: { - path: 'docs', - sidebarPath: 'sidebars.js', - }, - blog: false, - theme: { - customCss: ['./src/css/custom.scss'], - }, - sitemap: { - changefreq: 'daily', - priority: 0.5, - }, - gtag: { - trackingID: 'G-S4SD5NXWXF', - anonymizeIP: true, - }, - // debug: true, - }, - ], - ], - plugins: [ - 'docusaurus-plugin-image-zoom', - 'docusaurus-plugin-sass', - path.resolve(__dirname, './src/plugin/plugin-baidu-tongji'), - path.resolve(__dirname, './src/plugin/plugin-baidu-push'), - [ - path.resolve(__dirname, './src/plugin/plugin-content-blog'), // 为了实现全局 blog 数据,必须改写 plugin-content-blog 插件 - { - path: 'blog', - editUrl: ({ locale, blogDirPath, blogPath, permalink }) => - `https://github.com/kuizuo/blog/edit/main/${blogDirPath}/${blogPath}`, - editLocalizedFiles: false, - blogDescription: '代码人生:编织技术与生活的博客之旅', - blogSidebarCount: 10, - blogSidebarTitle: 'Blogs', - postsPerPage: 10, - showReadingTime: true, - readingTime: ({ content, frontMatter, defaultReadingTime }) => - defaultReadingTime({ content, options: { wordsPerMinute: 300 } }), - feedOptions: { - type: 'all', - title: '愧怍', - copyright: `Copyright © ${new Date().getFullYear()} 愧怍 Built with Docusaurus.

${beian}

`, - }, - }, - ], - [ - '@docusaurus/plugin-ideal-image', - { disableInDev: false }, - ], - [ - '@docusaurus/plugin-pwa', - { - debug: true, - offlineModeActivationStrategies: [ - 'appInstalled', - 'standalone', - 'queryString', - ], - pwaHead: [ - { tagName: 'link', rel: 'icon', href: '/img/logo.png' }, - { tagName: 'link', rel: 'manifest', href: '/manifest.json' }, - { tagName: 'meta', name: 'theme-color', content: '#12affa' }, - ], - }, - ], - ], - stylesheets: [], - i18n: { - defaultLocale: 'zh-CN', - locales: ['en', 'zh-CN'], - localeConfigs: { - en: { - htmlLang: 'en-GB', - }, - }, - }, - } -} diff --git a/docusaurus.config.ts b/docusaurus.config.ts new file mode 100644 index 00000000..5c6da823 --- /dev/null +++ b/docusaurus.config.ts @@ -0,0 +1,261 @@ +import path from 'node:path' +import type { Config } from '@docusaurus/types' +import type * as Preset from '@docusaurus/preset-classic' +import { themes } from 'prism-react-renderer' + +const beian = '闽ICP备2020017848号-2' +const beian1 = '闽公网安备35021102000847号' + +const config: Config = { + title: '愧怍的小站', + url: 'https://kuizuo.cn', + baseUrl: '/', + favicon: 'img/favicon.ico', + organizationName: 'kuizuo', + projectName: 'blog', + tagline: '道阻且长,行则将至', + themeConfig: { + // announcementBar: { + // id: 'announcementBar-3', + // content: ``, + // }, + metadata: [ + { + name: 'keywords', + content: '愧怍, kuizuo', + }, + { + name: 'keywords', + content: 'blog, javascript, typescript, node, react, vue, web', + }, + { + name: 'keywords', + content: '编程爱好者, Web开发者, 写过爬虫, 学过逆向, 现在主攻ts全栈', + }, + ], + docs: { + sidebar: { + hideable: true, + }, + }, + headTags: [ + { + tagName: 'meta', + attributes: { + name: 'description', + content: '愧怍的个人博客', + }, + }, + ], + navbar: { + logo: { + alt: '愧怍', + src: 'img/logo.webp', + srcDark: 'img/logo.webp', + }, + hideOnScroll: true, + items: [ + { + label: '博客', + position: 'right', + to: 'blog', + }, + { + label: '项目', + position: 'right', + to: 'project', + }, + { + label: '更多', + position: 'right', + items: [ + { label: '归档', to: 'blog/archive' }, + { label: '笔记', to: 'docs/skill' }, + { label: '资源', to: 'resource' }, + { label: '友链', to: 'friends' }, + { label: '工具推荐', to: 'docs/tools' }, + ], + }, + { + type: 'localeDropdown', + position: 'right', + }, + ], + }, + footer: { + style: 'dark', + links: [ + { + title: '学习', + items: [ + { label: '博客', to: 'blog' }, + { label: '归档', to: 'blog/archive' }, + { label: '技术笔记', to: 'docs/skill' }, + { label: '实战项目', to: 'project' }, + { label: '前端示例', to: 'https://example.kuizuo.cn' }, + ], + }, + { + title: '社交媒体', + items: [ + { label: '关于我', to: '/about' }, + { label: 'GitHub', href: 'https://github.com/kuizuo' }, + { label: 'Twitter', href: 'https://twitter.com/kuizuo' }, + { + label: '掘金', + href: 'https://juejin.cn/user/1565318510545901', + }, + { label: 'Discord', href: 'https://discord.gg/M8cVcjDxkz' }, + ], + }, + { + title: '更多', + items: [ + { label: '友链', position: 'right', to: 'friends' }, + { label: '导航', position: 'right', to: 'resource' }, + // { label: '我的站点', position: 'right', to: 'website' }, + { + html: ``, + }, + ], + }, + ], + copyright: ` +

${beian}

+

${beian1}

+

Copyright © 2020 - PRESENT 愧怍 Built with Docusaurus.

+ `, + }, + algolia: { + appId: 'GV6YN1ODMO', + apiKey: '50303937b0e4630bec4a20a14e3b7872', + indexName: 'kuizuo', + }, + giscus: { + repo: 'kuizuo/blog', + repoId: 'MDEwOlJlcG9zaXRvcnkzOTc2MjU2MTI=', + category: 'General', + categoryId: 'DIC_kwDOF7NJDM4CPK95', + theme: 'light', + darkTheme: 'dark_dimmed', + }, + socials: { + github: 'https://github.com/kuizuo', + twitter: 'https://twitter.com/kuizuo', + juejin: 'https://juejin.cn/user/1565318510545901', + csdn: 'https://blog.csdn.net/kuizuo12', + qq: 'https://wpa.qq.com/msgrd?v=3&uin=911993023&site=qq', + zhihu: 'https://www.zhihu.com/people/kuizuo', + cloudmusic: 'https://music.163.com/#/user/home?id=1333010742', + email: 'mailto:hi@kuizuo.cn', + }, + prism: { + theme: themes.oneLight, + darkTheme: themes.oneDark, + additionalLanguages: ['bash', 'json', 'java', 'php', 'rust', 'toml'], + defaultLanguage: 'javascript', + magicComments: [ + { + className: 'theme-code-block-highlighted-line', + line: 'highlight-next-line', + block: { start: 'highlight-start', end: 'highlight-end' }, + }, + { + className: 'code-block-error-line', + line: 'This will error', + }, + ], + }, + tableOfContents: { + minHeadingLevel: 2, + maxHeadingLevel: 4, + }, + liveCodeBlock: { + playgroundPosition: 'top', + }, + zoom: { + selector: '.markdown :not(em) > img', + background: { + light: 'rgb(255, 255, 255)', + dark: 'rgb(50, 50, 50)', + }, + }, + } satisfies Preset.ThemeConfig, + presets: [ + [ + 'classic', + { + docs: { + path: 'docs', + sidebarPath: 'sidebars.ts', + }, + blog: false, + theme: { + customCss: ['./src/css/custom.scss'], + }, + sitemap: { + priority: 0.5, + }, + gtag: { + trackingID: 'G-S4SD5NXWXF', + anonymizeIP: true, + }, + // debug: true, + } satisfies Preset.Options, + ], + ], + plugins: [ + 'docusaurus-plugin-image-zoom', + 'docusaurus-plugin-sass', + path.resolve(__dirname, './src/plugin/plugin-baidu-tongji'), + path.resolve(__dirname, './src/plugin/plugin-baidu-push'), + [ + path.resolve(__dirname, './src/plugin/plugin-content-blog'), // 为了实现全局 blog 数据,必须改写 plugin-content-blog 插件 + { + path: 'blog', + editUrl: ({ locale, blogDirPath, blogPath, permalink }) => + `https://github.com/kuizuo/blog/edit/main/${blogDirPath}/${blogPath}`, + editLocalizedFiles: false, + blogDescription: '代码人生:编织技术与生活的博客之旅', + blogSidebarCount: 10, + blogSidebarTitle: 'Blogs', + postsPerPage: 10, + showReadingTime: true, + readingTime: ({ content, frontMatter, defaultReadingTime }) => + defaultReadingTime({ content, options: { wordsPerMinute: 300 } }), + feedOptions: { + type: 'all', + title: '愧怍', + copyright: `Copyright © ${new Date().getFullYear()} 愧怍 Built with Docusaurus.

${beian}

`, + }, + }, + ], + ['@docusaurus/plugin-ideal-image', { disableInDev: false }], + [ + '@docusaurus/plugin-pwa', + { + debug: true, + offlineModeActivationStrategies: ['appInstalled', 'standalone', 'queryString'], + pwaHead: [ + { tagName: 'link', rel: 'icon', href: '/img/logo.png' }, + { tagName: 'link', rel: 'manifest', href: '/manifest.json' }, + { tagName: 'meta', name: 'theme-color', content: '#12affa' }, + ], + }, + ], + ], + stylesheets: [], + i18n: { + defaultLocale: 'zh-CN', + locales: ['en', 'zh-CN'], + localeConfigs: { + en: { + htmlLang: 'en-GB', + }, + }, + }, +} + +export default config diff --git a/sidebars.js b/sidebars.ts similarity index 95% rename from sidebars.js rename to sidebars.ts index 170c7f70..735bf723 100644 --- a/sidebars.js +++ b/sidebars.ts @@ -1,5 +1,6 @@ -/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ -const sidebars = { +import type { SidebarsConfig } from '@docusaurus/plugin-content-docs' + +const sidebars: SidebarsConfig = { skill: [ 'skill/introduction', { @@ -7,7 +8,7 @@ const sidebars = { type: 'category', link: { type: 'doc', - id: 'skill/docusaurus/docusaurus-guides' + id: 'skill/docusaurus/docusaurus-guides', }, items: [ 'skill/docusaurus/docusaurus-config', @@ -24,7 +25,7 @@ const sidebars = { type: 'category', link: { type: 'doc', - id: 'skill/code-specification/code-specification-guides' + id: 'skill/code-specification/code-specification-guides', }, items: [ 'skill/code-specification/eslint', @@ -145,10 +146,10 @@ const sidebars = { 'skill/programming-languages/go/go-send-http-request', 'skill/programming-languages/go/go-call-js', 'skill/programming-languages/go/go-concurrent', - 'skill/programming-languages/go/try-gin-framework' + 'skill/programming-languages/go/try-gin-framework', ], }, - ] + ], }, { label: 'Git', @@ -166,13 +167,13 @@ const sidebars = { type: 'category', link: { type: 'doc', - id: 'skill/algorithm/algorithm-introduction' + id: 'skill/algorithm/algorithm-introduction', }, items: [ 'skill/algorithm/two-sum', 'skill/algorithm/three-sum', 'skill/algorithm/sliding-window', - 'skill/algorithm/double-pointer' + 'skill/algorithm/double-pointer', ], }, { @@ -318,7 +319,7 @@ const sidebars = { 'tools/idea-config', 'tools/vite-plugin', 'tools/jetbrains-product-activation-method', - ] + ], } module.exports = sidebars diff --git a/react-app-env.d.ts b/src/style.d.ts similarity index 61% rename from react-app-env.d.ts rename to src/style.d.ts index da9f0657..a73d4eda 100644 --- a/react-app-env.d.ts +++ b/src/style.d.ts @@ -2,3 +2,8 @@ declare module '*.module.scss' { const classes: { readonly [key: string]: string } export default classes } + +declare module '*.scss' { + const src: string + export default src +} diff --git a/src/types.d.ts b/src/types.d.ts new file mode 100644 index 00000000..bd8aea05 --- /dev/null +++ b/src/types.d.ts @@ -0,0 +1,4 @@ +/// +/// +/// +///