Skip to content

Commit 05eb3f2

Browse files
committed
docs(v0.2.0): updated to the release version v0.2.0 along with the main repository.
1 parent 85e754e commit 05eb3f2

59 files changed

Lines changed: 10074 additions & 136 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/deploy.yml‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Deploy Docs Website to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: 'pages'
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
with:
24+
# 如果开启了 Starlight 的最后更新时间(lastUpdated)功能,需要拉取完整 Git 历史
25+
fetch-depth: 0
26+
27+
- name: Install, build, and upload Astro site
28+
uses: withastro/action@v3
29+
30+
deploy:
31+
environment:
32+
name: github-pages
33+
url: ${{ steps.deployment.outputs.page_url }}
34+
runs-on: ubuntu-latest
35+
needs: build
36+
steps:
37+
- name: Deploy to GitHub Pages
38+
id: deployment
39+
uses: actions/deploy-pages@v4

‎README.md‎

Lines changed: 64 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,82 @@
1-
# Starlight Starter Kit: Basics
1+
<div align="center">
22

3-
[![Built with Starlight](https://astro.badg.es/v2/built-with-starlight/tiny.svg)](https://starlight.astro.build)
3+
4+
# <image src="./src/assets/mini.png" height="30"/> UniDesktop Website
45

5-
```
6-
pnpm create astro@latest -- --template starlight
7-
```
6+
UniDesktop API(UDA)官方文档站,基于 [Astro](https://astro.build) + [Starlight](https://starlight.astro.build) 构建。
7+
8+
[Main Repo](https://github.com/UniDesktop/SDK)
9+
10+
</div>
11+
12+
## 站点定位
13+
14+
本站是 UDA 的官方文档源:安装引导、能力与降级模型、按模块的 API 参考、平台支持矩阵、排障手册与协议细节。
15+
16+
内容按四个 sidebar 分组组织,且 `en/` 与 `zh-cn/` 两棵目录逐页镜像:
817

9-
> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
18+
| 分组 | 内容 |
19+
|------|------|
20+
| `getting-started` | 安装、从源码构建、Hello desktop |
21+
| `guides` | 外观、壁纸、通知、托盘、媒体、会话、WakeLock、能力与降级、排障 |
22+
| `reference` | C-ABI、状态码、平台支持矩阵、Python / Node.js SDK |
23+
| `internals` | 架构、降级引擎、协议细节(Portal / SNI / DBusMenu / NotifyIcon)、贡献指南 |
1024

11-
## 🚀 Project Structure
25+
线上地址:[https://unidesktop.github.io/Website/](https://unidesktop.github.io/Website/)
1226

13-
Inside of your Astro + Starlight project, you'll see the following folders and files:
27+
28+
## 目录结构
1429

1530
```
1631
.
17-
├── public/
32+
├── public/ # 静态资源,原样拷贝到站点根(favicon.png)
1833
├── src/
19-
│ ├── assets/
20-
│ ├── content/
21-
│ │ └── docs/
22-
│ └── content.config.ts
23-
├── astro.config.mjs
24-
├── package.json
25-
└── tsconfig.json
34+
│ ├── assets/ # 构建期处理的图片(首页 hero 图标、顶栏 logo)
35+
│ └── content/docs/ # 全部文档,按 locale 分目录
36+
│ ├── en/ # 英文页(.md / .mdx)
37+
│ └── zh-cn/ # 简体中文页,defaultLocale
38+
├── astro.config.mjs # 站点标题、logo、favicon、sidebar、locale 配置
39+
└── package.json
2640
```
2741

28-
Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on its file name.
42+
约定:
43+
44+
- 每个 `.md` / `.mdx` 文件即一个路由,路径与文件名一致;`index.mdx` 是该目录的 landing page。
45+
- frontmatter `description` 若包含英文冒号,必须加引号,否则 js-yaml 解析会报 `bad indentation of a mapping entry`。
46+
- 首页使用 `template: splash`,`hero.image.file` 指向 `src/assets/` 下的图片,由 Starlight 自动裁剪尺寸并产出深浅色两套资源。
47+
- sidebar 四个分组均为 `autogenerate`,新增页面放进对应目录即可自动出现在导航里,无需改配置。
48+
- 站内互链写绝对路径并带 locale 前缀,例如 `/zh-cn/guides/tray/`、`/en/reference/c-abi/`。
49+
50+
## 本地开发
51+
52+
需要 Node.js 20+ 与 npm。所有命令在仓库根目录执行:
53+
54+
| 命令 | 作用 |
55+
| :--- | :--- |
56+
| `npm install` | 安装依赖 |
57+
| `npm run dev` | 启动开发服务器,默认 `http://localhost:4321` |
58+
| `npm run build` | 产出静态站点到 `dist/` |
59+
| `npm run preview` | 本地预览构建产物,部署前自查 |
60+
61+
## 部署流程
2962

30-
Images can be added to `src/assets/` and embedded in Markdown with a relative link.
63+
仓库通过 GitHub Pages 发布到 `https://unidesktop.github.io/Website/`:
3164

32-
Static assets, like favicons, can be placed in the `public/` directory.
65+
1. 在 `master` 上完成改动并 `npm run build` 验证通过。
66+
2. 推送 `master`,由仓库的 Pages 设置将 `dist/` 发布到线上。
67+
3. 上线后抽查:首页 hero、语言切换、四个 sidebar 分组、页内锚点与站内互链。
3368

34-
## 🧞 Commands
69+
`astro.config.mjs` 中的 `defaultLocale` 为 `zh-cn`,因此根路径 `/` 直接渲染中文首页,英文站位于 `/en/`。
3570

36-
All commands are run from the root of the project, from a terminal:
71+
## 内容维护规范
3772

38-
| Command | Action |
39-
| :------------------------ | :----------------------------------------------- |
40-
| `pnpm install` | Installs dependencies |
41-
| `pnpm dev` | Starts local dev server at `localhost:4321` |
42-
| `pnpm build` | Build your production site to `./dist/` |
43-
| `pnpm preview` | Preview your build locally, before deploying |
44-
| `pnpm astro ...` | Run CLI commands like `astro add`, `astro check` |
45-
| `pnpm astro -- --help` | Get help using the Astro CLI |
73+
- **双语同步**:`en/` 的每个页面都必须在 `zh-cn/` 有对应页,且 frontmatter 的 `title` 与正文结构保持一致;不允许只更新一侧。
74+
- **命名口径**:项目名统一写作 `UniDesktop API`(缩写 `UDA`),不得再使用旧名。
75+
- **新增页面**:放入对应分组目录,frontmatter 补齐 `title` 与 `description`,然后确认它在两侧导航中都可见。
76+
- **示例代码**:与 SDK 仓库 `examples/` 的实际调用保持一致,改 API 时必须同步文档。
4677

47-
## 👀 Want to learn more?
78+
## 相关链接
4879

49-
Check out [Starlight’s docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build), or jump into the [Astro Discord server](https://astro.build/chat).
80+
- 文档站:[https://unidesktop.github.io/Website/](https://unidesktop.github.io/Website/)
81+
- SDK 仓库:[https://github.com/UniDesktop/SDK](https://github.com/UniDesktop/SDK)
82+
- Starlight 文档:[https://starlight.astro.build/](https://starlight.astro.build/)

‎astro.config.mjs‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ import starlight from '@astrojs/starlight';
44

55
// https://astro.build/config
66
export default defineConfig({
7+
site: 'https://unidesktop.github.io',
8+
base: '/Website/',
79
integrations: [
810
starlight({
9-
title: 'United Desktop Association',
11+
title: 'UniDesktop API',
1012
favicon: '/public/favicon.png',
1113
logo: {
1214
src: './src/assets/houston.webp',
@@ -15,15 +17,20 @@ export default defineConfig({
1517
sidebar: [
1618
{
1719
label: 'Guides',
18-
items: [
19-
// Each item here is one entry in the navigation menu.
20-
{ label: 'Example Guide', slug: 'guides/example' },
21-
],
20+
items: [{ autogenerate: { directory: 'guides' } }],
2221
},
2322
{
2423
label: 'Reference',
2524
items: [{ autogenerate: { directory: 'reference' } }],
2625
},
26+
{
27+
label: 'Getting started',
28+
items: [{ autogenerate: { directory: 'getting-started' } }],
29+
},
30+
{
31+
label: 'Internals',
32+
items: [{ autogenerate: { directory: 'internals' } }],
33+
},
2734
],
2835
defaultLocale: 'zh-cn',
2936
locales: {

0 commit comments

Comments
 (0)