Skip to content

Commit

Permalink
feat: docs
Browse files Browse the repository at this point in the history
  • Loading branch information
whes1015 committed Nov 29, 2024
1 parent b4fd94c commit f21d7da
Show file tree
Hide file tree
Showing 9 changed files with 144 additions and 2 deletions.
57 changes: 57 additions & 0 deletions docs/trem/miscellaneous/dependencies.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
sidebar_position: 3
---

# 依賴關係

擴充之間的依賴關係

## 聲明依賴

`info.json` 中 聲明

:::tip

依賴中 `trem` 為必須的。

:::

:::tip 版本格式說明
版本號格式為: 主版本.次版本.修訂版本-預發布標識

例如: `3.0.0-pre.1`

支援的版本規則格式:

`>=3.0.0-pre.1` - 大於等於指定版本

`<=3.0.0-pre.4` - 小於等於指定版本

`<3.0.0-pre.4` - 小於指定版本

`>3.0.0-pre.4` - 大於指定版本

`=3.0.0-pre.4` - 等於指定版本

`>=3.0.0-pre.1 <=3.0.0-pre.4` - 版本需同時符合兩個條件
:::

```json
{
// ...
"dependencies": {
"trem": ">=3.0.0" // 擴充所需的 TREM 最低版本
}
// ...
}
```

## 用途

檢查是否有執行擴充所需的其他擴充

:::tip

舉例來說,`websocket` 需要 `exptech` 提供地震報告資料。換句話說,`exptech` 就是 `websocket` 所必需的依賴。

:::
15 changes: 15 additions & 0 deletions docs/trem/miscellaneous/event.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
sidebar_position: 6
---

# 自定義事件註冊

除了 TREM 本身,擴充還可以分發自己的事件。

:::tip

**自定義事件**是擴充之間,傳遞訊息的一種方式。

:::

## 用法
17 changes: 17 additions & 0 deletions docs/trem/miscellaneous/events_list.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
sidebar_position: 1
---

# 事件列表

查看可用的事件。

## 目錄

- onServerStartEvent

## onServerStartEvent

#### 回傳參數 `pid`

當伺服器被啟動
16 changes: 16 additions & 0 deletions docs/trem/miscellaneous/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
sidebar_position: 3
---

# 雜項

這裡紀錄著,一些瑣碎的東西。

## 目錄

- [事件列表](./events_list)
- [版本管理](./version)
- [依賴關係](./dependencies)
- [日誌紀錄](./logger)
- [導入 擴充 的 函數](./require)
- [自定義事件註冊](./event)
5 changes: 5 additions & 0 deletions docs/trem/miscellaneous/logger.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
sidebar_position: 4
---

# 日誌紀錄
5 changes: 5 additions & 0 deletions docs/trem/miscellaneous/require.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
sidebar_position: 5
---

# 導入其他擴充
27 changes: 27 additions & 0 deletions docs/trem/miscellaneous/version.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
sidebar_position: 2
---

# 版本管理

擴充作者應做好版本管理

## 擴充版本命名方式

`X.Y.Z`

### X 主版號

當產品進行了重大的更新或功能改變,影響了向下相容性,或完全重寫了代碼時,應增加 `主版號`

- 1.5.8 -> 2.0.0

### Y 次版號

擴充新增功能後,應增加 `次版號`,然後 `修訂號` 歸零。

- 1.1.5 -> 1.2.0

### Z 修訂號

擴充修復錯誤或問題增加 `修訂號`
2 changes: 1 addition & 1 deletion docs/trem/plugin_dev/event.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ sidebar_position: 2
<span style={{ color: "red" }}>❗ 不推薦的做法</span>

:::caution
不保證事件發生後,執行的優先順序,應考慮 [Mixin](./mixin.mdx)
不保證事件發生後,執行的優先順序,應考慮 [Mixin](./mixin)
:::

```js
Expand Down
2 changes: 1 addition & 1 deletion docs/trem/plugin_dev/index.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 4
sidebar_position: 2
---

# 擴充開發
Expand Down

0 comments on commit f21d7da

Please sign in to comment.