Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
any committed Oct 11, 2024
0 parents commit 3725f4f
Show file tree
Hide file tree
Showing 22 changed files with 3,683 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# 构建 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@v3 # 如果使用 pnpm,请取消注释
# - uses: oven-sh/setup-bun@v1 # 如果使用 Bun,请取消注释
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm # 或 pnpm / yarn
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: npm ci # 或 pnpm install / yarn install / bun install
- name: Build with VitePress
run: npm run docs:build # 或 pnpm docs:build / yarn docs:build / bun run docs:build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.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
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Files
.DS_Store
.history
.env

# Folders
node_modules/
**/.vitepress/cache
coverage
dist
.cache/

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
Empty file added .prettierignore
Empty file.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# language

```shell
npm i # install dependencies
npm run docs:dev # edit document
npm run docs:build # pack document
npm run docs:preview # view document
npm run code # run demos
```
49 changes: 49 additions & 0 deletions docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { defineConfig } from "vitepress";
import sidebar from "./sidebar/index.js";
import baidu from "./head.baidu.js";
import pkg from "../../package.json";

const { license, author, config } = pkg;
const { title, description, repourl } = config.vitepress;

export default defineConfig({
title, // 网站标题
description, // 网站描述
base: "/language/", // 路由前缀
srcDir: ".", //docs与.vitepress文件夹的关系
cleanUrls: true,
head: [
[
"link",
{
rel: "icon",
type: "image/png",
sizes: "16x16",
href: "./assets/favicon-16x16.png",
},
],
["script", {}, baidu],
],
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: "UPL", link: "/upl/" },
{ text: "DSL", link: "/dsl/" },
{ text: "Protocol", link: "/protocol/" },
],
sidebar,
socialLinks: [{ icon: "github", link: repourl }],
footer: {
message: `Released under the ${license} License.`,
copyright: `Copyright © 2020-${new Date().getFullYear()}-${author.name}`,
},
editLink: {
pattern: `${repourl}/edit/main/:path`,
text: `Edit this page on ${repourl}`,
},
lastUpdated: false,
search: {
provider: "local",
},
},
});
7 changes: 7 additions & 0 deletions docs/.vitepress/head.baidu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default `var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?3e4d7bac52542136df96a8e4617fdcc9";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();`;
79 changes: 79 additions & 0 deletions docs/.vitepress/sidebar/dsl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
export default [
{
text: "bnf",
items: [],
},
{
text: "uml",
items: [],
},
{
text: "xml",
items: [],
},
{
text: "html",
items: [],
},
{
text: "css",
items: [],
},
{
text: "markdown",
items: [],
},
{
text: "shell",
items: [],
},
{
text: "glob",
items: [],
},
{
text: "regexp",
items: [],
},
{
text: "json",
items: [],
},
{
text: "yaml",
items: [],
},
{
text: "toml",
items: [],
},
{
text: "latex",
items: [],
},
{
text: "cron",
items: [],
},
{
text: "lambda",
items: [],
},
{
text: "drools",
items: [],
},

{
text: "sql",
items: [],
},
{
text: "graphQl",
items: [],
},
{
text: "restful",
items: [],
},
];
14 changes: 14 additions & 0 deletions docs/.vitepress/sidebar/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import javascript from "./javascript.js";
import dsl from "./dsl.js";
import protocol from "./protocol.js";

export default {
"/upl/": [
{ text: "Clang", items: [] },
{ text: "Rust", items: [] },
javascript,
{ text: "TypeScript", items: [] },
],
"/dsl/": dsl,
"/protocol/": protocol,
};
Loading

0 comments on commit 3725f4f

Please sign in to comment.