Skip to content

Commit

Permalink
project: init
Browse files Browse the repository at this point in the history
  • Loading branch information
Glomzzz committed Sep 28, 2024
1 parent 2b8b98b commit 34667e8
Show file tree
Hide file tree
Showing 87 changed files with 9,915 additions and 2 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# 构建 VitePress 站点并将其部署到 GitHub Pages 的示例工作流程
#
name: Deploy VitePress site to Pages

on:
# 在针对 `main` 分支的推送上运行。如果你
# 使用 `master` 分支作为默认分支,请将其更改为 `master`
push:
branches: [ main ]

# 允许你从 Actions 选项卡手动运行此工作流程
workflow_dispatch:

# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成
concurrency:
group: pages
cancel-in-progress: false

jobs:
# 构建工作
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # 如果未启用 lastUpdated,则不需要
- uses: pnpm/action-setup@v2
with:
version: 9.5.0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm # 或 pnpm / yarn
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: pnpm install # 或 pnpm install / yarn install / bun install
- name: Build with VitePress
run: pnpm run build # 或 pnpm docs:build / yarn docs:build / bun run docs:build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: .vitepress/dist

# 部署工作
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
136 changes: 136 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
.vscode
.idea

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
.vitepress/cache/
.obsidian/
.vscode/
152 changes: 152 additions & 0 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
// noinspection JSUnusedGlobalSymbols

import {defineConfig} from 'vitepress'
import {defaultLang, langs} from './config/locales';
import {markdown} from './config/markdown';
import {getNav} from './config/nav'
import {locales as sidebarLocales} from './config/sidebar'
import {locales as siteLocales} from './config/site'
import {provider, search} from './config/components/search'
import {level, outlines} from './config/outline'

export const locales = (() => {
const config: any = {}
for (const name in langs) {
const lang = langs[name];
config[name] = {
...langs[name],
...siteLocales[name],
themeConfig: {
nav: getNav(lang.lang) ?? getNav(name),
sidebar: sidebarLocales[lang.lang] ?? sidebarLocales[name],
outline: {
label: outlines[lang.lang]?.outlineTitle ?? outlines[name]?.outlineTitle,
level
}
}
}
}
return config
})()
export default defineConfig({
head: [['link', {rel: 'icon', href: '/assets/favicon.ico'}]],
lang: defaultLang.lang,
//更简洁的url,去掉.html
cleanUrls: true,
//页面元数据可缓存,减少服务器带宽
metaChunk: true,
//导入markdown配置
markdown,
//导入locales配置
locales,
vue: {
template: {
compilerOptions: {
isCustomElement: (tag) => customElements.includes(tag),
},
},
},

vite: {},


themeConfig: {
nav: [],
sidebar: [],
socialLinks: [
{icon: 'github', link: 'https://github.com/Glomzzz/Rhapsody'}
],
search: search[provider]
}
})

const customElements = [
'mjx-container',
'mjx-assistive-mml',
'math',
'maction',
'maligngroup',
'malignmark',
'menclose',
'merror',
'mfenced',
'mfrac',
'mi',
'mlongdiv',
'mmultiscripts',
'mn',
'mo',
'mover',
'mpadded',
'mphantom',
'mroot',
'mrow',
'ms',
'mscarries',
'mscarry',
'mscarries',
'msgroup',
'mstack',
'mlongdiv',
'msline',
'mstack',
'mspace',
'msqrt',
'msrow',
'mstack',
'mstack',
'mstyle',
'msub',
'msup',
'msubsup',
'mtable',
'mtd',
'mtext',
'mtr',
'munder',
'munderover',
'semantics',
'math',
'mi',
'mn',
'mo',
'ms',
'mspace',
'mtext',
'menclose',
'merror',
'mfenced',
'mfrac',
'mpadded',
'mphantom',
'mroot',
'mrow',
'msqrt',
'mstyle',
'mmultiscripts',
'mover',
'mprescripts',
'msub',
'msubsup',
'msup',
'munder',
'munderover',
'none',
'maligngroup',
'malignmark',
'mtable',
'mtd',
'mtr',
'mlongdiv',
'mscarries',
'mscarry',
'msgroup',
'msline',
'msrow',
'mstack',
'maction',
'semantics',
'annotation',
'annotation-xml',

];
36 changes: 36 additions & 0 deletions .vitepress/config/author.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

import { localesOf } from "./locales";

type Author = {
name:string,
icon?:string,
link?:string,
}

export const locales = localesOf<Record<string,Author>>({})

locales['root'] = {
'Glomzzz': {
name: 'Glomzzz',
icon: '/assets/authors/glomzzz.png',
link: 'https://github.com/Glomzzz',
},
'none': {
name: '未知作者',
icon: '/assets/authors/unknown.svg',
}
}

locales.en = {
'Glomzzz': {
name: 'Glomzzz',
icon: '/assets/authors/glomzzz.png',
link: 'https://github.com/Glomzzz',
},
'none': {
name: 'Unknown',
icon: '/assets/authors/unknown.svg',
}
}
export const unknownAuthorId = 'none'
export const ownerId = 'Glomzzz'
Loading

0 comments on commit 34667e8

Please sign in to comment.