From f6e73dd3beb12327cb097883f4a768de3af823cb Mon Sep 17 00:00:00 2001 From: snowy Date: Wed, 28 Aug 2024 11:38:46 +0800 Subject: [PATCH] =?UTF-8?q?:memo:=20=E6=B5=8B=E8=AF=95=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy-docs.yml | 64 +++++++++++++++++++ .github/workflows/pypi-publish.yml | 20 ++++++ docs/.vitepress/config.mts | 15 ++++- docs/.vitepress/config/common.ts | 13 ++++ docs/.vitepress/config/en.ts | 10 +++ docs/.vitepress/config/index.ts | 15 +++++ docs/.vitepress/config/zh.ts | 10 +++ docs/{api-examples.md => api-ex.md} | 0 docs/api/{indedx.md => index.md} | 3 +- docs/api/mp_math/{indedx.md => index.md} | 0 docs/api/particle/{indedx.md => index.md} | 0 docs/api/presets/{indedx.md => index.md} | 0 .../api/presets/model/{indedx.md => index.md} | 0 docs/index.md | 6 +- docs/{markdown-examples.md => md-ex.md} | 0 docs/mkdoc.py | 2 +- mbcp/__init__.py | 1 + mbcp/mp_math/__init__.py | 8 +++ 18 files changed, 159 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/deploy-docs.yml create mode 100644 .github/workflows/pypi-publish.yml create mode 100644 docs/.vitepress/config/common.ts create mode 100644 docs/.vitepress/config/en.ts create mode 100644 docs/.vitepress/config/index.ts create mode 100644 docs/.vitepress/config/zh.ts rename docs/{api-examples.md => api-ex.md} (100%) rename docs/api/{indedx.md => index.md} (93%) rename docs/api/mp_math/{indedx.md => index.md} (100%) rename docs/api/particle/{indedx.md => index.md} (100%) rename docs/api/presets/{indedx.md => index.md} (100%) rename docs/api/presets/model/{indedx.md => index.md} (100%) rename docs/{markdown-examples.md => md-ex.md} (100%) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 0000000..eece8af --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml new file mode 100644 index 0000000..4ede3b5 --- /dev/null +++ b/.github/workflows/pypi-publish.yml @@ -0,0 +1,20 @@ +name: Publish + +on: + release: + types: [published] + +jobs: + pypi-publish: + name: upload release to PyPI + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - uses: actions/checkout@v3 + + - uses: pdm-project/setup-pdm@v3 + + - name: Publish package distributions to PyPI + run: pdm publish diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 75104cd..72532fd 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -4,6 +4,16 @@ import { defineConfig } from 'vitepress' export default defineConfig({ title: "MBCP docs", description: "MBCP library docs", + locales: { + root: { + label: '简体中文', + lang: 'zh-CN' + }, + en: { + label: 'English', + lang: 'en-US' + } + }, themeConfig: { // https://vitepress.dev/reference/default-theme-config nav: [ @@ -22,7 +32,8 @@ export default defineConfig({ ], socialLinks: [ - { icon: 'github', link: 'https://github.com/vuejs/vitepress' } + { icon: 'github', link: 'https://github.com/snowykami/mbcp' } ] - } + }, + srcDir: '.' }) diff --git a/docs/.vitepress/config/common.ts b/docs/.vitepress/config/common.ts new file mode 100644 index 0000000..977378b --- /dev/null +++ b/docs/.vitepress/config/common.ts @@ -0,0 +1,13 @@ +import {defineConfig, type DefaultTheme} from 'vitepress' + +export const common = defineConfig({ + title: "MBCP docs", + description: "MBCP library docs", + themeConfig: { + // https://vitepress.dev/reference/default-theme-config + socialLinks: [ + {icon: 'github', link: 'https://github.com/snowykami/mbcp'} + ] + }, + srcDir: '.' +}) \ No newline at end of file diff --git a/docs/.vitepress/config/en.ts b/docs/.vitepress/config/en.ts new file mode 100644 index 0000000..a2c3824 --- /dev/null +++ b/docs/.vitepress/config/en.ts @@ -0,0 +1,10 @@ +import {defineConfig, type DefaultTheme} from 'vitepress' + +export const en = defineConfig({ + + lang: "en-US", + description: "A library made for Minecraft particle generation", + + themeConfig: { + }, +}) \ No newline at end of file diff --git a/docs/.vitepress/config/index.ts b/docs/.vitepress/config/index.ts new file mode 100644 index 0000000..0f14210 --- /dev/null +++ b/docs/.vitepress/config/index.ts @@ -0,0 +1,15 @@ +import {defineConfig} from "vitepress"; + +import {common} from './common' +import {en} from './en' +import {zh} from './zh' + + + +export default defineConfig({ + ...common, + locales:{ + root: { label: "简体中文", ...zh }, + en: { label: "English", ...en } + } +}) \ No newline at end of file diff --git a/docs/.vitepress/config/zh.ts b/docs/.vitepress/config/zh.ts new file mode 100644 index 0000000..203268f --- /dev/null +++ b/docs/.vitepress/config/zh.ts @@ -0,0 +1,10 @@ +import {defineConfig, type DefaultTheme} from 'vitepress' + +export const zh = defineConfig({ + + lang: "zh-Hans", + description: "一个用于Minecraft粒子计算和生成的库", + + themeConfig: { + }, +}) \ No newline at end of file diff --git a/docs/api-examples.md b/docs/api-ex.md similarity index 100% rename from docs/api-examples.md rename to docs/api-ex.md diff --git a/docs/api/indedx.md b/docs/api/index.md similarity index 93% rename from docs/api/indedx.md rename to docs/api/index.md index daef73b..f28b6d1 100644 --- a/docs/api/indedx.md +++ b/docs/api/index.md @@ -3,5 +3,4 @@ title: mbcp.\n\ninit\n\n order: 1 icon: laptop-code category: API ---- - +--- \ No newline at end of file diff --git a/docs/api/mp_math/indedx.md b/docs/api/mp_math/index.md similarity index 100% rename from docs/api/mp_math/indedx.md rename to docs/api/mp_math/index.md diff --git a/docs/api/particle/indedx.md b/docs/api/particle/index.md similarity index 100% rename from docs/api/particle/indedx.md rename to docs/api/particle/index.md diff --git a/docs/api/presets/indedx.md b/docs/api/presets/index.md similarity index 100% rename from docs/api/presets/indedx.md rename to docs/api/presets/index.md diff --git a/docs/api/presets/model/indedx.md b/docs/api/presets/model/index.md similarity index 100% rename from docs/api/presets/model/indedx.md rename to docs/api/presets/model/index.md diff --git a/docs/index.md b/docs/index.md index 51d63d6..a2f37f2 100644 --- a/docs/index.md +++ b/docs/index.md @@ -9,10 +9,10 @@ hero: actions: - theme: brand text: 快速开始 - link: /guide + link: md-ex - theme: alt - text: API - link: api + text: API文档 + link: api/ features: - title: 高可用性 diff --git a/docs/markdown-examples.md b/docs/md-ex.md similarity index 100% rename from docs/markdown-examples.md rename to docs/md-ex.md diff --git a/docs/mkdoc.py b/docs/mkdoc.py index 67083da..2bd10ee 100644 --- a/docs/mkdoc.py +++ b/docs/mkdoc.py @@ -301,7 +301,7 @@ def generate_docs(module_folder: str, output_dir: str, with_top: bool = False, l os.mkdir(output_dir) replace_data = { - "__init__": "indedx", + "__init__": "index", ".py" : ".md", } diff --git a/mbcp/__init__.py b/mbcp/__init__.py index b89c326..6321264 100644 --- a/mbcp/__init__.py +++ b/mbcp/__init__.py @@ -8,3 +8,4 @@ Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved @File : __init__.py @Software: PyCharm """ +from .mp_math import * diff --git a/mbcp/mp_math/__init__.py b/mbcp/mp_math/__init__.py index a7e0f3e..68f3c7a 100644 --- a/mbcp/mp_math/__init__.py +++ b/mbcp/mp_math/__init__.py @@ -8,3 +8,11 @@ Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved @File : __init__.py.py @Software: PyCharm """ +from .angle import AnyAngle +from .const import * +from .equation import CurveEquation +from .line import Line3 +from plane import Plane3 +from .point import Point3 +from .segment import Segment3 +from .vector import Vector3