> ## Documentation Index
> Fetch the complete documentation index at: https://ayakaleaf-pro.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 開發指南

> overleaf-pro 的貢獻指南，涵蓋儲存庫同步限制、分支慣例，以及常見的上游與版本問答。

### 簡介

在您深入開發之前，我們希望您先了解以下幾點：

* Overleaf 官方是在一個[內部儲存庫](http://github.com/overleaf/internal)中進行開發，社群版則發布於 [overleaf/overleaf](https://github.com/overleaf/overleaf)。一個 copybot 負責在內部與公開儲存庫之間同步程式碼。
* [Ayaka-notes/overleaf-pro](https://github.com/ayaka-notes/overleaf-pro) 是 Overleaf 社群版的分支版本。我們希望這個專案能夠長期維護，因此在貢獻之前請遵守以下規則。

### 提交規則

* 請勿對既有的 Overleaf 程式碼進行大幅修改。請盡可能將功能集中在 `services/web/modules` 資料夾中，這能將我們日後合併與更新程式碼的工作量降到最低。
* Vibe coding 確實是一種非常簡便的方式，但它很容易把專案弄得一團亂，導致日後難以維護，因此請謹慎使用。
* 開發期間請勿新增任何與翻譯相關的內容；請盡可能使用既有的翻譯。
* 除非絕對必要，否則請避免引入環境變數。若確實需要，請確保它們盡可能與 Overleaf toolkit 或 [docs.overleaf.com](https://docs.overleaf.com/) 中的環境變數保持一致。

### 分支規則

我們在 overleaf-pro 開發中使用以下分支：

* `main`：此分支僅用於同步上游程式碼，請**不要**提交任何外部變更。在此分支中，我們會設定一些像 `ce-v[X.x.x]` 這樣的標籤，表示其對應於 Overleaf 官方社群版的 `v[X.x.x]`。注意：此標籤不可變更！
* `server-pro`：此分支是日常開發的預設分支。
* `feature-X`：此分支用於開發特定功能。
* `release-vX.0.0`：專門用於發布的分支，我們會在發布前於此進行一些 hot-fix。

<Frame caption="Overleaf Pro 的分支規則">
  <img src="https://mintcdn.com/ayakaleaf-pro/x9kfDjtWlyyhG_mR/images/dev/release-model.png?fit=max&auto=format&n=x9kfDjtWlyyhG_mR&q=85&s=8a10a259ff5a6437cb05f03560a5dc2c" alt="" width="5652" height="2544" data-path="images/dev/release-model.png" />
</Frame>

### GitHub Action

[GitHub Action](https://github.com/ayaka-notes/overleaf-pro/actions) 負責自動化 CI/CD，內容包括：

* 每晚更新 main 分支
* 建置開發用的 Docker 映像檔
* 發布 Docker 映像檔

### 問與答

<Accordion title="如何找到 Overleaf 社群版 `X.0.0` 對應的 commit hash？">
  首先，您需要拉取 Docker 映像檔，並執行以下指令來檢視該映像檔中的標籤：

  ```shellscript title="bash" wrap theme={null}
  docker inspect --format='{{json .Config.Labels}}' sharelatex/sharelatex:6.0.0
  {"com.overleaf.ce.revision":"b0d05c0cf0750714e1f467d20ed6c5f5e9467e8f","org.opencontainers.image.ref.name":"ubuntu","org.opencontainers.image.version":"24.04"}
  ```

  接著，您可以檢查該 [commit(b0d05c0)](https://github.com/overleaf/overleaf/commit/b0d05c0cf0750714e1f467d20ed6c5f5e9467e8f) 是否存在於上游的 master 分支中。
</Accordion>

<Accordion title="為什麼 `6.0.0` 與 `6.0.1` 的 CE 映像檔中 commit hash 相同？">
  這是預期中的行為。6.0.1 是建立在 6.0.0 映像檔之上的小型修補版本。這些變更是透過修補既有的 6.0.0 映像檔來套用，而不是從新的 commit 重新建置映像檔。因此，映像檔內的 commit hash 在 6.0.0 與 6.0.1 之間是相同的。

  詳細資訊請參閱 [hotfix](https://github.com/overleaf/overleaf/tree/main/server-ce/hotfix)。
</Accordion>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.