mirror of
https://github.com/gkd-kit/docs.git
synced 2024-11-16 00:22:20 +08:00
feat: init
This commit is contained in:
commit
98b0743926
40
.github/workflows/gh-pages.yml
vendored
Normal file
40
.github/workflows/gh-pages.yml
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
name: gh-pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
gh-pages:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- uses: pnpm/action-setup@v2
|
||||
- run: pnpm -v
|
||||
|
||||
- run: pnpm install
|
||||
|
||||
- run: pnpm exec tsx ./.vitepress/scripts/updateVersion.ts
|
||||
- run: pnpm run docs:build-mirror
|
||||
|
||||
- name: Publish package
|
||||
run: |
|
||||
pnpm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
|
||||
pnpm publish --no-git-checks
|
||||
|
||||
- run: git checkout .
|
||||
- run: curl -X PUT 'https://registry-direct.npmmirror.com/@gkd-kit/docs/sync'
|
||||
|
||||
- uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./.vitepress/dist
|
||||
cname: gkd.li
|
22
.gitignore
vendored
Normal file
22
.gitignore
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
.env
|
||||
.vscode
|
||||
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
.eslintcache
|
||||
.vitepress/dist
|
||||
.vitepress/cache
|
6
.npmrc
Normal file
6
.npmrc
Normal file
|
@ -0,0 +1,6 @@
|
|||
strict-peer-dependencies=false
|
||||
auto-install-peers=false
|
||||
registry="https://registry.npmjs.org/"
|
||||
public-hoist-pattern[]=vue
|
||||
public-hoist-pattern[]=vite
|
||||
public-hoist-pattern[]=@vueuse/core
|
5
.prettierignore
Normal file
5
.prettierignore
Normal file
|
@ -0,0 +1,5 @@
|
|||
pnpm-lock.yaml
|
||||
pnpm-workspace.yaml
|
||||
LICENCE
|
||||
|
||||
dist
|
9
.prettierrc.mjs
Normal file
9
.prettierrc.mjs
Normal file
|
@ -0,0 +1,9 @@
|
|||
// @ts-check
|
||||
/**
|
||||
* @type {import('prettier').Config}
|
||||
*/
|
||||
export default {
|
||||
tabWidth: 2,
|
||||
singleQuote: true,
|
||||
trailingComma: 'all',
|
||||
};
|
56
.vitepress/config.ts
Normal file
56
.vitepress/config.ts
Normal file
|
@ -0,0 +1,56 @@
|
|||
import { defineConfig } from 'vitepress';
|
||||
import { mirror } from './plugins';
|
||||
|
||||
const useMirror = process.env.MIRROR == `ON`;
|
||||
|
||||
// https://vitepress.dev/reference/site-config
|
||||
export default defineConfig({
|
||||
title: 'GKD',
|
||||
description: '自定义屏幕点击应用',
|
||||
assetsDir:'',
|
||||
head: [
|
||||
[
|
||||
'link',
|
||||
{
|
||||
rel: 'icon',
|
||||
type: 'image/svg+xml',
|
||||
href: '/logo.svg',
|
||||
},
|
||||
],
|
||||
],
|
||||
themeConfig: {
|
||||
// https://vitepress.dev/reference/default-theme-config
|
||||
logo: '/logo.svg',
|
||||
nav: [{ text: '首页', link: '/' }],
|
||||
sidebar: [
|
||||
{
|
||||
text: '指引',
|
||||
items: [
|
||||
{ text: '开始使用', link: '/guide/' },
|
||||
{ text: '高级选择器', link: '/selector/' },
|
||||
{ text: '订阅规则', link: '/scription/' },
|
||||
{ text: '疑难解答', link: '/faq/' },
|
||||
],
|
||||
},
|
||||
],
|
||||
editLink: {
|
||||
pattern: 'https://github.com/gkd-kit/docs/edit/main/:path',
|
||||
text: '为此页提供修改建议',
|
||||
},
|
||||
search: {
|
||||
provider: 'local',
|
||||
},
|
||||
socialLinks: [{ icon: 'github', link: 'https://github.com/gkd-kit' }],
|
||||
footer: {
|
||||
message: 'Released under the GPL-v3 License.',
|
||||
copyright: `Copyright © ${new Date().getFullYear()} GKD. All rights reserved`,
|
||||
},
|
||||
},
|
||||
vite: {
|
||||
plugins: [useMirror && mirror()].filter(Boolean),
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
port: 8633,
|
||||
},
|
||||
},
|
||||
});
|
1
.vitepress/plugins/index.ts
Normal file
1
.vitepress/plugins/index.ts
Normal file
|
@ -0,0 +1 @@
|
|||
export * from './mirror';
|
27
.vitepress/plugins/mirror.ts
Normal file
27
.vitepress/plugins/mirror.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
import fs from 'node:fs/promises';
|
||||
import type { Plugin } from 'vite';
|
||||
import type selfPkgT from '../../package.json';
|
||||
|
||||
const selfPkg: typeof selfPkgT = JSON.parse(
|
||||
await fs.readFile(process.cwd() + '/package.json', 'utf-8'),
|
||||
);
|
||||
|
||||
const mirrorBaseUrl = `https://registry.npmmirror.com/@gkd-kit/docs/${selfPkg.version}/files/.vitepress/dist`;
|
||||
|
||||
export const mirror = (): Plugin => {
|
||||
return {
|
||||
name: 'mirror',
|
||||
apply: 'build',
|
||||
enforce: 'post',
|
||||
config() {
|
||||
return {
|
||||
experimental: {
|
||||
renderBuiltUrl(filename) {
|
||||
// TODO renderBuiltUrl 在 vitepress 中不起作用
|
||||
return mirrorBaseUrl + '/' + filename;
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
};
|
15
.vitepress/scripts/updateVersion.ts
Normal file
15
.vitepress/scripts/updateVersion.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import fs from 'node:fs/promises';
|
||||
import type selfPkgT from '../../package.json';
|
||||
|
||||
const selfPkg: typeof selfPkgT = JSON.parse(
|
||||
await fs.readFile(process.cwd() + '/package.json', 'utf-8'),
|
||||
);
|
||||
selfPkg.version = `0.0.` + Date.now();
|
||||
|
||||
await fs.writeFile(
|
||||
process.cwd() + '/package.json',
|
||||
JSON.stringify(selfPkg, undefined, 2),
|
||||
'utf-8',
|
||||
);
|
||||
|
||||
console.log(`change package.json version to ` + selfPkg.version);
|
7
.vitepress/theme/custom.css
Normal file
7
.vitepress/theme/custom.css
Normal file
|
@ -0,0 +1,7 @@
|
|||
.medium-zoom-overlay {
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
.medium-zoom-image {
|
||||
z-index: 21;
|
||||
}
|
27
.vitepress/theme/index.ts
Normal file
27
.vitepress/theme/index.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
import mediumZoom from 'medium-zoom';
|
||||
import DefaultTheme from 'vitepress/theme';
|
||||
import { onMounted } from 'vue';
|
||||
import './custom.css';
|
||||
|
||||
const zoomImages = () => {
|
||||
const images = Array.from(
|
||||
document.querySelectorAll<HTMLImageElement>('img[data-zoomable]'),
|
||||
);
|
||||
for (const img of images) {
|
||||
if (!img.getAttribute('zoom-inited')) {
|
||||
img.setAttribute('zoom-inited', 'true');
|
||||
// https://github.com/vuejs/vitepress/issues/854#issuecomment-1232938474
|
||||
mediumZoom(img, { background: 'rgba(0,0,0,0.7)' });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
...DefaultTheme,
|
||||
setup() {
|
||||
onMounted(() => {
|
||||
zoomImages();
|
||||
setInterval(zoomImages, 2000);
|
||||
});
|
||||
},
|
||||
};
|
1
faq/index.md
Normal file
1
faq/index.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 疑难解答
|
1
guide/index.md
Normal file
1
guide/index.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 开始使用
|
35
index.md
Normal file
35
index.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
# https://vitepress.dev/reference/default-theme-home-page
|
||||
layout: home
|
||||
|
||||
title: GKD
|
||||
titleTemplate: 自定义屏幕点击应用
|
||||
|
||||
hero:
|
||||
name: 'GKD'
|
||||
text: '自定义屏幕点击应用'
|
||||
tagline: '基于无障碍+高级选择器+订阅规则'
|
||||
actions:
|
||||
- theme: brand
|
||||
text: 开始使用
|
||||
link: /guide/
|
||||
- theme: alt
|
||||
text: 高级选择器
|
||||
link: /selector/
|
||||
- theme: alt
|
||||
text: 订阅规则
|
||||
link: /scription/
|
||||
- theme: alt
|
||||
text: 疑难解答
|
||||
link: /faq/
|
||||
|
||||
features:
|
||||
- title: 🐔 开放源代码
|
||||
details: 任何人均可审查源代码, 确保安全性和质量
|
||||
- title: 🐦 高级选择器
|
||||
details: 一种能联系节点上下文信息的的高级选择器, 更容易也更精确找到目标节点
|
||||
- title: 🎤 订阅规则
|
||||
details: 您可编写本地订阅满足自己需求, 远程订阅能让您直接使用大众维护的开源规则
|
||||
- title: 🏀 快照审查
|
||||
details: 捕获的快照可通过审查工具测试选择器帮助自定义规则, 也可直接分享快照寻求别人的帮助
|
||||
---
|
34
package.json
Normal file
34
package.json
Normal file
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"name": "@gkd-kit/docs",
|
||||
"author": "lisonge",
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"files": [
|
||||
"./.vitepress/dist"
|
||||
],
|
||||
"scripts": {
|
||||
"docs:dev": "vitepress dev",
|
||||
"docs:build": "vitepress build",
|
||||
"docs:preview": "vitepress preview",
|
||||
"docs:build-mirror": "cross-env MIRROR=ON vitepress build",
|
||||
"format": "prettier --cache --write ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@gkd-kit/selector": "0.0.16",
|
||||
"@types/node": "^20.10.6",
|
||||
"medium-zoom": "^1.1.0",
|
||||
"prettier": "^3.1.1",
|
||||
"tsx": "^4.7.0",
|
||||
"typescript": "^5.3.3",
|
||||
"vitepress": "^1.0.0-rc.34",
|
||||
"cross-env": "^7.0.3"
|
||||
},
|
||||
"volta": {
|
||||
"node": "20.10.0"
|
||||
},
|
||||
"packageManager": "pnpm@8.11.0"
|
||||
}
|
1112
pnpm-lock.yaml
Normal file
1112
pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load Diff
0
public/.nojekyll
Normal file
0
public/.nojekyll
Normal file
1
public/CNAME
Normal file
1
public/CNAME
Normal file
|
@ -0,0 +1 @@
|
|||
gkd.li
|
2713
public/logo.svg
Normal file
2713
public/logo.svg
Normal file
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 83 KiB |
1
scription/index.md
Normal file
1
scription/index.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 订阅规则
|
1
selector/index.md
Normal file
1
selector/index.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 高级选择器
|
17
tsconfig.json
Normal file
17
tsconfig.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"lib": ["ESNext", "DOM"],
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler",
|
||||
"resolveJsonModule": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"sourceMap": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["./.vitepress/**/*.ts"]
|
||||
}
|
Loading…
Reference in New Issue
Block a user