|
1 | | -# Starlight Starter Kit: Basics |
| 1 | +<div align="center"> |
2 | 2 |
|
3 | | -[](https://starlight.astro.build) |
| 3 | + |
| 4 | +# <image src="./src/assets/mini.png" height="30"/> UniDesktop Website |
4 | 5 |
|
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/` 两棵目录逐页镜像: |
8 | 17 |
|
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)、贡献指南 | |
10 | 24 |
|
11 | | -## 🚀 Project Structure |
| 25 | +线上地址:[https://unidesktop.github.io/Website/](https://unidesktop.github.io/Website/) |
12 | 26 |
|
13 | | -Inside of your Astro + Starlight project, you'll see the following folders and files: |
| 27 | + |
| 28 | +## 目录结构 |
14 | 29 |
|
15 | 30 | ``` |
16 | 31 | . |
17 | | -├── public/ |
| 32 | +├── public/ # 静态资源,原样拷贝到站点根(favicon.png) |
18 | 33 | ├── 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 |
26 | 40 | ``` |
27 | 41 |
|
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 | +## 部署流程 |
29 | 62 |
|
30 | | -Images can be added to `src/assets/` and embedded in Markdown with a relative link. |
| 63 | +仓库通过 GitHub Pages 发布到 `https://unidesktop.github.io/Website/`: |
31 | 64 |
|
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 分组、页内锚点与站内互链。 |
33 | 68 |
|
34 | | -## 🧞 Commands |
| 69 | +`astro.config.mjs` 中的 `defaultLocale` 为 `zh-cn`,因此根路径 `/` 直接渲染中文首页,英文站位于 `/en/`。 |
35 | 70 |
|
36 | | -All commands are run from the root of the project, from a terminal: |
| 71 | +## 内容维护规范 |
37 | 72 |
|
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 时必须同步文档。 |
46 | 77 |
|
47 | | -## 👀 Want to learn more? |
| 78 | +## 相关链接 |
48 | 79 |
|
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/) |
0 commit comments