Skip to content

Commit

Permalink
feat: init
Browse files Browse the repository at this point in the history
  • Loading branch information
fz6m committed Jun 30, 2024
0 parents commit 88f4868
Show file tree
Hide file tree
Showing 27 changed files with 2,460 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

name: Publish page

on:
push:
branches:
- main
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
pages: write
id-token: write
contents: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2.2.2
with:
run_install: false

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'pnpm'

- name: Install dependencies
run: pnpm i

- name: Build
run: |
pnpm docs:build
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/.vitepress/dist
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.DS_Store
/node_modules
/docs/.vitepress/dist
/docs/.vitepress/cache
/docs-old
.pnpm-*.log
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# opq-helper

OPQBot 文档站。
27 changes: 27 additions & 0 deletions docs/.vitepress/components/IndexMounted.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<template> </template>

<script>
const oscUrl = `https://github.com/opq-osc`
export default {
// hack footer 部分
// 使其可以点击跳转到 osc
mounted() {
const licenseElm = document.querySelector('.VPFooter .message')
if (!licenseElm) {
return
}
const text = licenseElm.textContent
const handleHtml = /* html */ `
<a
target='_blank'
href='${oscUrl}'
style='text-decoration: none; color: inherit;'
>
${text}
</a>
`
licenseElm.innerHTML = handleHtml
},
}
</script>
42 changes: 42 additions & 0 deletions docs/.vitepress/components/Link.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<template>
<a
target="_blank"
:href="link"
rel="noopener noreferrer"
:title="name"
class="link"
>
{{ name }}
</a>
</template>

<script>
export default {
props: {
link: String,
name: String,
},
}
</script>

<style lang="scss" scoped>
.link {
padding: 5px 10px;
border-radius: 4px;
transition: all 0.4s ease;
cursor: pointer;
user-select: none;
text-decoration: none;
font-weight: 450;
font-size: 18px;
margin: 0 -5px;
&:hover {
background-color: rgba(0, 0, 0, 0.05);
}
&:active {
background-color: rgba(0, 0, 0, 0.2);
}
}
</style>
155 changes: 155 additions & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
import { defineConfig } from 'vitepress'

const lang = 'zh-CN'
const ogDescription = 'OPQ 文档站'
const ogImage =
'https://cdn.jsdelivr.net/gh/opq-osc/opq-helper@main/images/opq.1200x630.v2.jpg'
const ogTitle = ogDescription

// GitHub Pages
// const siteBase = '/opq-helper/'
// const ogUrl = `https://opq-osc.github.io${siteBase}`

// Official Site
const ogUrl = 'https://opqbot.com/'

const year = new Date().getFullYear()

const PATHS = {
docker: '/guide/docker-start',
zero_start: '/guide/quick-start',

// sdk
sdk: '/project/sdk',
} as const

export default defineConfig({
title: 'OPQHelper',
description: ogDescription,
lang,
lastUpdated: true,
// base: siteBase,

head: [
['link', { rel: 'icon', href: '/favicon.png' }],
['meta', { property: 'og:type', content: 'website' }],
['meta', { property: 'og:title', content: ogTitle }],
['meta', { property: 'og:image', content: ogImage }],
['meta', { property: 'og:url', content: ogUrl }],
['meta', { property: 'twitter:description', content: ogDescription }],
['meta', { property: 'twitter:title', content: ogTitle }],
['meta', { property: 'twitter:card', content: 'summary_large_image' }],
['meta', { property: 'twitter:image', content: ogImage }],
['meta', { property: 'twitter:url', content: ogUrl }],
],

// https://github.com/vitejs/vite/issues/7854
// vue: {
// reactivityTransform: true
// },

themeConfig: {
logo: '/opq.logo-only.min.png',

outlineTitle: '查看目录',

editLink: {
pattern: 'https://github.com/opq-osc/opq-helper/edit/main/docs/:path',
text: 'Suggest changes to this page',
},

socialLinks: [{ icon: 'github', link: 'https://github.com/opq-osc/OPQ' }],

footer: {
message: 'OPQ Open Source Community',
copyright: `MIT Licensed | Copyright © ${year}`,
},

nav: [
{
text: '🚀 Guide',
items: [
{ text: '从零开始搭建 OPQBot', link: PATHS.zero_start },
{
text: 'Docker 快速搭建指南',
link: PATHS.docker,
},
],
},
{
text: '🌈 Project',
items: [{ text: 'SDK', link: PATHS.sdk }],
},
{
text: '✨ Wiki',
items: [
{
text: 'OPQBot Wiki',
link: 'https://apifox.com/apidoc/shared-72cecf14-815e-4238-82a5-6c68d006fd00',
},
],
},
{
text: '🎉 About',
link: '/about/join',
},
],

outline: [2, 6],

sidebar: {
'/guide/': [
{
text: '从零开始搭建 OPQBot',
link: PATHS.zero_start,
items: [
{
text: '准备环境',
link: `${PATHS.zero_start}#准备环境`,
},
{
text: '部署启动',
link: `${PATHS.zero_start}#部署启动`,
},
{
text: '进阶知识',
link: `${PATHS.zero_start}#进阶知识`,
},
{
text: '常见问题',
link: `${PATHS.zero_start}#常见问题`,
},
],
},
{
text: '使用 Docker 快速搭建',
items: [{ text: 'Docker', link: `${PATHS.docker}` }],
},
],
'/project/': [
{
text: '开发 SDK',
link: PATHS.sdk,
items: [
{
text: 'Python',
link: `${PATHS.sdk}#python`,
},
{
text: 'Go',
link: `${PATHS.sdk}#go`,
},
{
text: 'C#',
link: `${PATHS.sdk}#c`,
},
{
text: 'Ruby',
link: `${PATHS.sdk}#ruby`,
},
],
},
],
},
},
})
15 changes: 15 additions & 0 deletions docs/.vitepress/plugins/microApp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { MICRO_APP_ELM } from '../constants'

export const start = async () => {
const { registerMicroApps, start } = await import('qiankun')
registerMicroApps([
{
name: 'opqbot-notify',
entry:
'//fastly.jsdelivr.net/gh/opq-osc/opqbot-notify@gh-pages/index.html', // '//localhost:9528'
container: `#${MICRO_APP_ELM}`,
activeRule: '/',
},
])
start()
}
26 changes: 26 additions & 0 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { h } from 'vue'
import Theme from 'vitepress/theme'
import './styles/vars.css'
import './styles/global.scss'

// @ts-ignore
import Link from '../components/Link.vue'
// @ts-ignore
import IndexMounted from '../components/IndexMounted.vue'

const components = {
Link,
IndexMounted,
}

export default {
...Theme,
Layout() {
return h(Theme.Layout, null, {})
},
enhanceApp({ app }) {
Object.keys(components).forEach((c) => {
app.component(c, components[c])
})
},
}
14 changes: 14 additions & 0 deletions docs/.vitepress/theme/styles/global.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
body {
cursor: url('/blue.cur'), auto;
}

.container {
.content {
.main {
h2 {
padding-top: 30px;
margin-top: 30px;
}
}
}
}
Loading

0 comments on commit 88f4868

Please sign in to comment.