snapshot of https://github.com/toeverything/AFFiNE.git (canary, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Build & Test / Analyze (javascript, blocksuite) (push) Failing after 3s
Build & Test / Rust test filter (push) Failing after 3s
Build & Test / E2E BlockSuite Test (2) (push) Failing after 3s
Build & Test / E2E BlockSuite Test (3) (push) Failing after 4s
Build & Test / E2E BlockSuite Test (4) (push) Failing after 3s
Build & Test / E2E BlockSuite Cross Browser Test (push) Failing after 3s
Build & Test / E2E Mobile Test (1) (push) Failing after 3s
Build & Test / E2E Mobile Test (2) (push) Failing after 3s
Build & Test / Build AFFiNE native (x86_64-unknown-linux-gnu) (push) Failing after 4s
Build & Test / Unit Test (1) (push) Has been skipped
Build & Test / Unit Test (2) (push) Has been skipped
Build & Test / Unit Test (3) (push) Has been skipped
Build & Test / Build Server native (push) Failing after 3s
Build & Test / Check Git Status (push) Has been skipped
Build & Test / Server Test (0, 4) (push) Has been skipped
Build & Test / Server Test (1, 4) (push) Has been skipped
Build & Test / Analyze (javascript, affine) (push) Failing after 3s
Build & Test / Analyze (typescript, affine) (push) Failing after 3s
Build & Test / Analyze (typescript, blocksuite) (push) Failing after 3s
Build & Test / Mobile native build filter (push) Failing after 3s
Build & Test / Check yarn binary (push) Failing after 3s
Build & Test / E2E BlockSuite Test (1) (push) Failing after 4s
Build & Test / E2E BlockSuite Test (5) (push) Failing after 3s
Build & Test / Unit Test (4) (push) Has been skipped
Build & Test / Unit Test (5) (push) Has been skipped
Build & Test / Native Unit Test (push) Has been skipped
Build & Test / Server Test (2, 4) (push) Has been skipped
Build & Test / Server Test (3, 4) (push) Has been skipped
Build & Test / Server Test with Elasticsearch (push) Has been skipped
Build & Test / Server Test with Embedded Search (push) Has been skipped
Build & Test / Server Test with Manticore Search (push) Has been skipped
Build & Test / Server E2E Test (push) Has been skipped
Build & Test / Cloud Desktop E2E Test (push) Has been skipped
Build & Test / Cloud E2E Test 1/2 (push) Has been skipped
Build & Test / Cloud E2E Test 2/2 (push) Has been skipped
Build & Test / Build @affine/electron renderer (push) Failing after 3s
Build & Test / Copilot test filter (push) Failing after 4s
Build & Test / Lint Rust (push) Has been skipped
Build & Test / Build Android app (push) Has been skipped
Build & Test / Test Android app (push) Has been skipped
Build & Test / Run native tests (push) Has been skipped
Build & Test / Server Copilot Api Test (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (3, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (4, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (1, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (2, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (5, 5) (push) Has been skipped
Build & Test / Desktop Test (ubuntu-latest, linux, x64, x86_64-unknown-linux-gnu, true) (push) Has been cancelled
Build & Test / Desktop Test (windows-latest, windows, x64, x86_64-pc-windows-msvc, true) (push) Has been cancelled
Build & Test / 3, 2, 1 Launch (push) Has been cancelled
Build & Test / Lint (push) Has been cancelled
Build & Test / Typecheck (push) Has been cancelled
Build & Test / Build iOS app (push) Has been cancelled
Build & Test / Build AFFiNE native (aarch64-apple-darwin) (push) Has been cancelled
Build & Test / E2E Test (1) (push) Has been cancelled
Build & Test / E2E Test (2) (push) Has been cancelled
Build & Test / E2E Test (3) (push) Has been cancelled
Build & Test / E2E Test (4) (push) Has been cancelled
Build & Test / E2E Test (5) (push) Has been cancelled
Build & Test / Build AFFiNE native (x86_64-apple-darwin) (push) Has been cancelled
Build & Test / Build AFFiNE native (aarch64-pc-windows-msvc) (push) Has been cancelled
Build & Test / Build AFFiNE native (x86_64-pc-windows-msvc) (push) Has been cancelled
Build & Test / Desktop Test (macos-latest, macos, arm64, aarch64-apple-darwin, true) (push) Has been cancelled
Build & Test / Desktop Test (macos-latest, macos, x64, x86_64-apple-darwin, false) (push) Has been cancelled
Some checks failed
Build & Test / Analyze (javascript, blocksuite) (push) Failing after 3s
Build & Test / Rust test filter (push) Failing after 3s
Build & Test / E2E BlockSuite Test (2) (push) Failing after 3s
Build & Test / E2E BlockSuite Test (3) (push) Failing after 4s
Build & Test / E2E BlockSuite Test (4) (push) Failing after 3s
Build & Test / E2E BlockSuite Cross Browser Test (push) Failing after 3s
Build & Test / E2E Mobile Test (1) (push) Failing after 3s
Build & Test / E2E Mobile Test (2) (push) Failing after 3s
Build & Test / Build AFFiNE native (x86_64-unknown-linux-gnu) (push) Failing after 4s
Build & Test / Unit Test (1) (push) Has been skipped
Build & Test / Unit Test (2) (push) Has been skipped
Build & Test / Unit Test (3) (push) Has been skipped
Build & Test / Build Server native (push) Failing after 3s
Build & Test / Check Git Status (push) Has been skipped
Build & Test / Server Test (0, 4) (push) Has been skipped
Build & Test / Server Test (1, 4) (push) Has been skipped
Build & Test / Analyze (javascript, affine) (push) Failing after 3s
Build & Test / Analyze (typescript, affine) (push) Failing after 3s
Build & Test / Analyze (typescript, blocksuite) (push) Failing after 3s
Build & Test / Mobile native build filter (push) Failing after 3s
Build & Test / Check yarn binary (push) Failing after 3s
Build & Test / E2E BlockSuite Test (1) (push) Failing after 4s
Build & Test / E2E BlockSuite Test (5) (push) Failing after 3s
Build & Test / Unit Test (4) (push) Has been skipped
Build & Test / Unit Test (5) (push) Has been skipped
Build & Test / Native Unit Test (push) Has been skipped
Build & Test / Server Test (2, 4) (push) Has been skipped
Build & Test / Server Test (3, 4) (push) Has been skipped
Build & Test / Server Test with Elasticsearch (push) Has been skipped
Build & Test / Server Test with Embedded Search (push) Has been skipped
Build & Test / Server Test with Manticore Search (push) Has been skipped
Build & Test / Server E2E Test (push) Has been skipped
Build & Test / Cloud Desktop E2E Test (push) Has been skipped
Build & Test / Cloud E2E Test 1/2 (push) Has been skipped
Build & Test / Cloud E2E Test 2/2 (push) Has been skipped
Build & Test / Build @affine/electron renderer (push) Failing after 3s
Build & Test / Copilot test filter (push) Failing after 4s
Build & Test / Lint Rust (push) Has been skipped
Build & Test / Build Android app (push) Has been skipped
Build & Test / Test Android app (push) Has been skipped
Build & Test / Run native tests (push) Has been skipped
Build & Test / Server Copilot Api Test (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (3, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (4, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (1, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (2, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (5, 5) (push) Has been skipped
Build & Test / Desktop Test (ubuntu-latest, linux, x64, x86_64-unknown-linux-gnu, true) (push) Has been cancelled
Build & Test / Desktop Test (windows-latest, windows, x64, x86_64-pc-windows-msvc, true) (push) Has been cancelled
Build & Test / 3, 2, 1 Launch (push) Has been cancelled
Build & Test / Lint (push) Has been cancelled
Build & Test / Typecheck (push) Has been cancelled
Build & Test / Build iOS app (push) Has been cancelled
Build & Test / Build AFFiNE native (aarch64-apple-darwin) (push) Has been cancelled
Build & Test / E2E Test (1) (push) Has been cancelled
Build & Test / E2E Test (2) (push) Has been cancelled
Build & Test / E2E Test (3) (push) Has been cancelled
Build & Test / E2E Test (4) (push) Has been cancelled
Build & Test / E2E Test (5) (push) Has been cancelled
Build & Test / Build AFFiNE native (x86_64-apple-darwin) (push) Has been cancelled
Build & Test / Build AFFiNE native (aarch64-pc-windows-msvc) (push) Has been cancelled
Build & Test / Build AFFiNE native (x86_64-pc-windows-msvc) (push) Has been cancelled
Build & Test / Desktop Test (macos-latest, macos, arm64, aarch64-apple-darwin, true) (push) Has been cancelled
Build & Test / Desktop Test (macos-latest, macos, x64, x86_64-apple-darwin, false) (push) Has been cancelled
This commit is contained in:
232
docs/BUILDING.md
Normal file
232
docs/BUILDING.md
Normal file
@@ -0,0 +1,232 @@
|
||||
# Building AFFiNE Web
|
||||
|
||||
> **Warning**
|
||||
> This document is not guaranteed to be up-to-date.
|
||||
> If you find any outdated information, please feel free to open an issue or submit a PR.
|
||||
>
|
||||
> **Note**
|
||||
> This guide covers building and developing the **web app**.
|
||||
> For the desktop client app, see [building-desktop-client-app.md](./building-desktop-client-app.md).
|
||||
> For running the server (cloud features) locally, see [developing-server.md](./developing-server.md).
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Sign the CLA first](#sign-the-cla-first)
|
||||
- [Prerequisites](#prerequisites)
|
||||
- [Setup Environment](#setup-environment)
|
||||
- [Start Development Server](#start-development-server)
|
||||
- [Testing](#testing)
|
||||
- [Linting and Type Checking](#linting-and-type-checking)
|
||||
- [Submitting a Pull Request](#submitting-a-pull-request)
|
||||
- [Troubleshooting](#troubleshooting)
|
||||
- [Related Documents](#related-documents)
|
||||
|
||||
## Sign the CLA first
|
||||
|
||||
AFFiNE requires every contributor to sign the [Contributor License Agreement](../.github/CLA.md) before a pull request can be **merged**. The `license/cla` status check on your PR stays red — and blocks the merge — until every committer on the PR has signed. Signing takes less than a minute, so do it before (or right after) opening your first PR:
|
||||
|
||||
1. Open **<https://cla-assistant.io/toeverything/AFFiNE>**.
|
||||
2. Sign in with your GitHub account and agree.
|
||||
|
||||
If you opened your PR before signing, the CLA-assistant bot will have left a comment on it with a signing link. After signing, click the **recheck** link in that same comment (or push a new commit) to refresh the check.
|
||||
|
||||
If `license/cla` is still red after you signed:
|
||||
|
||||
- **Every committer must sign.** The bot's comment lists each commit author in the PR — every name marked with :x: still needs to sign, including co-authors.
|
||||
- **Your commit email must be linked to your GitHub account.** CLA assistant matches commits to GitHub users by the commit author email. Run `git log --format='%an %ae'` and make sure those emails appear in your [GitHub email settings](https://github.com/settings/emails). Otherwise, either add the email to GitHub, or rewrite the commits with the correct identity and force-push.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
AFFiNE client has both **Node.js** & **Rust** toolchains.
|
||||
|
||||
### Node.js
|
||||
|
||||
Develop with the Node.js version pinned in [`.nvmrc`](../.nvmrc) (currently Node.js **22**; `package.json` requires `>=22.12.0 <23.0.0`).
|
||||
|
||||
The easiest way is a version manager that reads `.nvmrc`:
|
||||
|
||||
```sh
|
||||
# with fnm (https://github.com/Schniz/fnm)
|
||||
fnm use --install-if-missing
|
||||
|
||||
# or with nvm (https://github.com/nvm-sh/nvm)
|
||||
nvm install && nvm use
|
||||
```
|
||||
|
||||
Alternatively, install Node.js 22 (LTS) manually from <https://nodejs.org/en/download>.
|
||||
|
||||
### Yarn
|
||||
|
||||
We use modern Yarn (currently **4.x**, pinned by the `packageManager` field in `package.json`). Yarn 1 will not work. Enable it via [Corepack](https://yarnpkg.com/corepack), which ships with Node.js:
|
||||
|
||||
```sh
|
||||
corepack enable
|
||||
```
|
||||
|
||||
After this, `yarn` inside the repository automatically resolves to the pinned version — verify with `yarn -v` (it should print `4.x`, not `1.x`).
|
||||
|
||||
### Rust
|
||||
|
||||
Install the Rust toolchain via [rustup](https://rustup.rs/). The required version is pinned in [`rust-toolchain.toml`](../rust-toolchain.toml), and rustup installs it automatically the first time you build inside the repository.
|
||||
|
||||
## Setup Environment
|
||||
|
||||
### Clone the repository
|
||||
|
||||
#### Linux & macOS
|
||||
|
||||
```sh
|
||||
git clone https://github.com/toeverything/AFFiNE
|
||||
cd AFFiNE
|
||||
```
|
||||
|
||||
#### Windows
|
||||
|
||||
In our codebase, we use symbolic links. Due to the security design of Windows, the creation of symbolic links requires administrator privileges. This is part of the security policy settings of Windows, and more information can be found at [Security Policy Settings for Creating Symbolic Links](https://learn.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/create-symbolic-links).
|
||||
|
||||
For detailed guidance on enabling this feature, please refer to the official documentation: [Enable Developer Mode on Windows](https://learn.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development).
|
||||
|
||||
Once Developer Mode is enabled, execute the following command with administrator privileges:
|
||||
|
||||
```sh
|
||||
# Enable symbolic links
|
||||
git config --global core.symlinks true
|
||||
# Clone the repository
|
||||
git clone https://github.com/toeverything/AFFiNE
|
||||
```
|
||||
|
||||
### Install dependencies
|
||||
|
||||
```sh
|
||||
yarn install
|
||||
```
|
||||
|
||||
This also initializes the workspace (`yarn affine init`) and installs the git hooks through the `postinstall` script.
|
||||
|
||||
### Build Native Dependencies
|
||||
|
||||
Run the following script. It will build the native module at [`packages/frontend/native`](../packages/frontend/native) and build Node.js binding using [NAPI.rs](https://napi.rs/). This could take a while if you build it for the first time.
|
||||
|
||||
```sh
|
||||
yarn affine @affine/native build
|
||||
```
|
||||
|
||||
> Note: use `strip` from system instead of `binutils` if you are running macOS. [See problem here](https://github.com/toeverything/AFFiNE/discussions/2840)
|
||||
|
||||
### Build Server Dependencies
|
||||
|
||||
Only needed if you plan to run the local server (cloud features) or the cloud E2E suites:
|
||||
|
||||
```sh
|
||||
yarn affine @affine/server-native build
|
||||
```
|
||||
|
||||
## Start Development Server
|
||||
|
||||
```sh
|
||||
yarn dev
|
||||
```
|
||||
|
||||
You will be prompted to choose which package to run — pick **`@affine/web`** for the web app, then open **<http://localhost:8080>**.
|
||||
|
||||
You can skip the prompt with the `-p` (`--package`) flag:
|
||||
|
||||
```sh
|
||||
yarn dev -p @affine/web
|
||||
```
|
||||
|
||||
Other dev targets include `@affine/server`, `@affine/electron`, `@affine/mobile`, `@affine/admin`, `@affine/ios` and `@affine/android`.
|
||||
|
||||
Running `@affine/web` alone is enough for most editor and UI work — workspaces are stored locally in the browser. To work on **cloud** features (accounts, sync, collaboration, AI), run the local server as well: follow [developing-server.md](./developing-server.md).
|
||||
|
||||
## Testing
|
||||
|
||||
Adding test cases is strongly encouraged when you contribute new features and bug fixes.
|
||||
|
||||
We use [Vitest](https://vitest.dev/) for unit tests and [Playwright](https://playwright.dev/) for E2E tests.
|
||||
|
||||
### Unit Test
|
||||
|
||||
```sh
|
||||
yarn test
|
||||
```
|
||||
|
||||
### E2E Test
|
||||
|
||||
Install the browser binaries once before the first run:
|
||||
|
||||
```sh
|
||||
npx playwright install
|
||||
```
|
||||
|
||||
The E2E suites live in [`tests`](../tests):
|
||||
|
||||
| Suite | Run with | Notes |
|
||||
| ---------------------- | ------------------------------------------------------ | --------------------------------------------------- |
|
||||
| `affine-local` | `yarn workspace @affine-test/affine-local e2e` | Web app, no server needed |
|
||||
| `affine-cloud` | `yarn workspace @affine-test/affine-cloud e2e` | Requires the [local server](./developing-server.md) |
|
||||
| `affine-cloud-copilot` | `yarn workspace @affine-test/affine-cloud-copilot e2e` | Requires the local server |
|
||||
| `affine-desktop` | `yarn workspace @affine-test/affine-desktop e2e` | Desktop (Electron) app |
|
||||
| `affine-desktop-cloud` | `yarn workspace @affine-test/affine-desktop-cloud e2e` | Desktop + local server |
|
||||
| `affine-mobile` | `yarn workspace @affine-test/affine-mobile e2e` | Mobile UI |
|
||||
|
||||
There is also `@affine-test/blocksuite` (`yarn workspace @affine-test/blocksuite test`) for BlockSuite integration tests.
|
||||
|
||||
## Linting and Type Checking
|
||||
|
||||
CI runs these checks on every PR — running them locally first saves you a review round trip:
|
||||
|
||||
```sh
|
||||
# lint (oxlint) + format check (oxfmt)
|
||||
yarn lint
|
||||
|
||||
# auto-fix lint & format issues
|
||||
yarn lint:fix
|
||||
|
||||
# TypeScript type check
|
||||
yarn typecheck
|
||||
```
|
||||
|
||||
## Submitting a Pull Request
|
||||
|
||||
1. Make sure you have [signed the CLA](#sign-the-cla-first).
|
||||
2. Fork the repository and create your branch from **`canary`** (the default development branch).
|
||||
3. Make your changes. Add or update tests where it makes sense, and run `yarn lint`, `yarn typecheck` and the relevant test suites locally.
|
||||
4. Open the PR against the `canary` branch of `toeverything/AFFiNE`.
|
||||
5. Give the PR a title that follows [Conventional Commits](https://www.conventionalcommits.org/) — this is enforced by the `PR Title Lint` CI check:
|
||||
|
||||
```text
|
||||
type(scope): short description
|
||||
|
||||
# examples
|
||||
fix(editor): keep text selection after paste
|
||||
feat(core): add custom icons for folders
|
||||
docs: update building guide
|
||||
```
|
||||
|
||||
- **Types**: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`
|
||||
- **Scopes** (optional; if present, must be one of): `admin`, `electron`, `server`, `core`, `web`, `mobile`, `ios`, `android`, `mobile-native`, `docs`, `component`, `env`, `graphql`, `hooks`, `i18n`, `native`, `templates`, `debug`, `nbstore`, `infra`, `editor`, `tools`, `y-octo`, `client`
|
||||
|
||||
6. Your PR can be merged once:
|
||||
- the **`license/cla`** check is green — every committer has signed the CLA;
|
||||
- CI passes — build & tests, PR title lint;
|
||||
- a maintainer has reviewed and approved it. Reviewers are assigned automatically, and an automated reviewer may also leave comments — please address or answer them.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **`yarn install` fails or complains about the Node/Yarn version** — check that `node -v` matches [`.nvmrc`](../.nvmrc) (`fnm use` / `nvm use`) and that Corepack is enabled (`yarn -v` should print `4.x`, not `1.x`).
|
||||
- **Native module fails to build on macOS** — make sure `strip` is the system one, not the one from `binutils` ([details](https://github.com/toeverything/AFFiNE/discussions/2840)).
|
||||
- **`EPERM: operation not permitted, symlink` on Windows** — enable Developer Mode and symlinks before cloning; see [Windows](#windows).
|
||||
- **App fails to start after pulling the latest `canary`** — dependencies or Rust bindings may have changed: re-run `yarn install` and `yarn affine @affine/native build`.
|
||||
- **Playwright can't find browsers** — run `npx playwright install`.
|
||||
- **The `license/cla` check stays red** — see [Sign the CLA first](#sign-the-cla-first).
|
||||
|
||||
## Related Documents
|
||||
|
||||
- [developing-server.md](./developing-server.md) — run the AFFiNE server locally (cloud features)
|
||||
- [building-desktop-client-app.md](./building-desktop-client-app.md) — build the desktop (Electron) client
|
||||
- [contributing/tutorial.md](./contributing/tutorial.md) — a walkthrough of the codebase
|
||||
- [types-of-contributions.md](./types-of-contributions.md) — ways to contribute beyond code
|
||||
- [issue-triaging.md](./issue-triaging.md) — how issues are triaged
|
||||
- [contributing/releases.md](./contributing/releases.md) — how releases are cut
|
||||
- [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md)
|
||||
45
docs/CODE_OF_CONDUCT.md
Normal file
45
docs/CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
- Using welcoming and inclusive language
|
||||
- Being respectful of differing viewpoints and experiences
|
||||
- Gracefully accepting constructive criticism
|
||||
- Focusing on what is best for the community
|
||||
- Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
- The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
- Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
- Public or private harassment
|
||||
- Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project maintainer. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.4, available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>
|
||||
|
||||
For answers to common questions about this code of conduct, see <https://www.contributor-covenant.org/faq>
|
||||
36
docs/CONTRIBUTING.md
Normal file
36
docs/CONTRIBUTING.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Contributing to AFFiNE
|
||||
|
||||
Thank you for your interest in contributing! ❤️ AFFiNE welcomes contributions of all kinds — code, docs, bug reports, feature ideas and translations. See [types-of-contributions.md](./types-of-contributions.md) for the full picture.
|
||||
|
||||
This page is the five-minute overview. The full contributor handbook lives at <https://docs.affine.pro/contributing>.
|
||||
|
||||
## Before your first pull request: sign the CLA
|
||||
|
||||
We can only merge pull requests whose authors have signed the [Contributor License Agreement](../.github/CLA.md). Every PR is checked automatically (the `license/cla` status check), and an unsigned CLA is the single most common reason PRs get stuck before merge.
|
||||
|
||||
**How to sign (takes under a minute):**
|
||||
|
||||
1. Open <https://cla-assistant.io/toeverything/AFFiNE>.
|
||||
2. Sign in with your GitHub account and agree.
|
||||
|
||||
Already opened a PR? Sign, then click the **recheck** link in the CLA bot's comment on your PR (or push a new commit). Note that **every** committer on the PR must sign, and each commit's author email must be [linked to a GitHub account](https://github.com/settings/emails). See [BUILDING.md — Sign the CLA first](./BUILDING.md#sign-the-cla-first) for troubleshooting.
|
||||
|
||||
## Contribution flow
|
||||
|
||||
1. **Find something to work on.** Browse [good first issues](https://github.com/toeverything/AFFiNE/contribute) or the [issue tracker](https://github.com/toeverything/AFFiNE/issues). Issues that are still in triage haven't been reviewed yet — better not to start work on those. For bigger changes, open a [discussion](https://github.com/toeverything/AFFiNE/discussions) or talk to us on [Discord](https://affine.pro/redirect/discord) first.
|
||||
2. **Set up your environment.** Follow [BUILDING.md](./BUILDING.md) for the web app. For the server (cloud features) see [developing-server.md](./developing-server.md); for the desktop client see [building-desktop-client-app.md](./building-desktop-client-app.md).
|
||||
3. **Make your change** on a branch created from `canary`. Add tests where it makes sense, and run `yarn lint`, `yarn typecheck` and the relevant tests locally.
|
||||
4. **Open a PR to `canary`** with a [Conventional Commits](https://www.conventionalcommits.org/) title, e.g. `fix(editor): keep selection after paste` — the title format is enforced by CI.
|
||||
5. **Get it merged.** A PR merges once the `license/cla` check is green, CI passes, and a maintainer approves the review.
|
||||
|
||||
## Code of conduct
|
||||
|
||||
Please read our [Code of Conduct](./CODE_OF_CONDUCT.md).
|
||||
|
||||
## Useful links
|
||||
|
||||
- Codebase tour: [contributing/tutorial.md](./contributing/tutorial.md)
|
||||
- How issues are triaged: [issue-triaging.md](./issue-triaging.md)
|
||||
- Release process: [contributing/releases.md](./contributing/releases.md)
|
||||
- Reporting security issues: [SECURITY.md](../SECURITY.md)
|
||||
- Community: [Discord](https://affine.pro/redirect/discord) · [GitHub Discussions](https://github.com/toeverything/AFFiNE/discussions)
|
||||
125
docs/building-desktop-client-app.md
Normal file
125
docs/building-desktop-client-app.md
Normal file
@@ -0,0 +1,125 @@
|
||||
# Building AFFiNE Desktop Client App
|
||||
|
||||
> **Warning**:
|
||||
>
|
||||
> This document is not guaranteed to be up-to-date.
|
||||
> If you find any outdated information, please feel free to open an issue or submit a PR.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Prerequisites](#prerequisites)
|
||||
- [Development](#development)
|
||||
- [Build](#build)
|
||||
- [CI](#ci)
|
||||
|
||||
## Things you may need to know before getting started
|
||||
|
||||
Building the desktop client app for the moment is a bit more complicated than building the web app. The client right now is an Electron app that wraps the prebuilt web app, with parts of the native modules written in Rust, which means we have the following source modules to build a desktop client app:
|
||||
|
||||
1. `packages/frontend/core`: the web app
|
||||
2. `packages/frontend/native`: the native modules written in Rust (mostly the sqlite bindings)
|
||||
3. `packages/frontend/apps/electron`: the Electron app (containing main & helper process, and the electron entry point in `packages/frontend/apps/electron-renderer`)
|
||||
|
||||
#3 is dependent on #1 and #2, and relies on electron-forge to make the final app & installer. To get a deep understanding of how the desktop client app is built, you may want to read the workflow file in [release-desktop.yml](/.github/workflows/release-desktop.yml).
|
||||
|
||||
Due to [some limitations of Electron builder](https://github.com/yarnpkg/berry/issues/4804), you may need to have two separate yarn config for building the core and the desktop client app:
|
||||
|
||||
1. build frontend (with default yarn settings)
|
||||
2. build electron (reinstall with hoisting off)
|
||||
|
||||
We will explain the steps in the following sections.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before you start building AFFiNE Desktop Client Application, please following the same steps in [BUILDING#Prerequisites](./BUILDING.md#prerequisites) to install Node.js and Rust.
|
||||
|
||||
On Windows, you must enable symbolic links this code repo. See [#### Windows](./BUILDING.md#Windows).
|
||||
|
||||
## Build, package & make the desktop client app
|
||||
|
||||
> repos/AFFiNE/.github/workflows/release-desktop.yml contains real order to build the desktop client app, but here we will explain the steps in a more detailed way. Up-to date.
|
||||
|
||||
### 0. Build the native modules
|
||||
|
||||
Please refer to `Build Native Dependencies` section in [BUILDING.md](./BUILDING.md#Build-Native-Dependencies) to build the native modules.
|
||||
|
||||
### 1. Build the core
|
||||
|
||||
On Mac & Linux
|
||||
|
||||
```shell
|
||||
BUILD_TYPE=canary yarn affine @affine/electron build
|
||||
|
||||
BUILD_TYPE=canary yarn affine @affine/electron generate-assets
|
||||
```
|
||||
|
||||
On Windows (powershell)
|
||||
|
||||
```powershell
|
||||
$env:BUILD_TYPE="canary"
|
||||
$env:DISTRIBUTION=desktop
|
||||
$env:SKIP_WEB_BUILD=1
|
||||
yarn build
|
||||
```
|
||||
|
||||
### 2. Re-config yarn, clean up the node_modules and reinstall the dependencies
|
||||
|
||||
As we said before, you need to reinstall the dependencies with hoisting off. You can do this by running the following command:
|
||||
|
||||
```shell
|
||||
yarn config set nmMode classic
|
||||
yarn config set nmHoistingLimits workspaces
|
||||
```
|
||||
|
||||
Then, clean up all node_modules and reinstall the dependencies:
|
||||
|
||||
On Mac & Linux
|
||||
|
||||
```shell
|
||||
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
|
||||
yarn install
|
||||
```
|
||||
|
||||
On Windows (powershell)
|
||||
|
||||
```powershell
|
||||
dir -Path . -Filter node_modules -recurse | foreach {echo $_.fullname; rm -r -Force $_.fullname}
|
||||
yarn install
|
||||
```
|
||||
|
||||
### 3. Build the desktop client app installer
|
||||
|
||||
#### Mac & Linux
|
||||
|
||||
Note: you need to comment out `osxSign` and `osxNotarize` in `forge.config.mjs` to skip signing and notarizing the app.
|
||||
|
||||
```shell
|
||||
BUILD_TYPE=canary SKIP_WEB_BUILD=1 HOIST_NODE_MODULES=1 yarn affine @affine/electron make
|
||||
```
|
||||
|
||||
#### Windows
|
||||
|
||||
Making the windows installer is a bit different. Right now we provide two installer options: squirrel and nsis.
|
||||
|
||||
```powershell
|
||||
$env:BUILD_TYPE="canary"
|
||||
$env:SKIP_WEB_BUILD=1
|
||||
$env:HOIST_NODE_MODULES=1
|
||||
yarn affine @affine/electron package
|
||||
yarn affine @affine/electron make-squirrel
|
||||
yarn affine @affine/electron make-nsis
|
||||
```
|
||||
|
||||
Once the build is complete, you can find the paths to the binaries in the terminal output.
|
||||
|
||||
```
|
||||
Finished 2 bundles at:
|
||||
› Artifacts available at: <affine-repo>/packages/frontend/apps/electron/out/canary/make
|
||||
```
|
||||
|
||||
## CI
|
||||
|
||||
Please refer to `.github/workflows/release-desktop-app.yml` for the CI workflow. It will:
|
||||
|
||||
- build the app for all supported platforms
|
||||
- upload the artifacts to GitHub Actions
|
||||
BIN
docs/contributing/assets/release-action.png
Normal file
BIN
docs/contributing/assets/release-action.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
48
docs/contributing/releases.md
Normal file
48
docs/contributing/releases.md
Normal file
@@ -0,0 +1,48 @@
|
||||
## AFFiNE Release Process
|
||||
|
||||
> In order to make a stable/beta release, you need to get authorization from the AFFiNE test team.
|
||||
|
||||
## Who Can Make a Release?
|
||||
|
||||
The AFFiNE core team grants release authorization and enforces the following requirements:
|
||||
|
||||
- Commit access to the AFFiNE repository.
|
||||
- Access to GitHub Actions.
|
||||
|
||||
## How to Make a Release
|
||||
|
||||
Before releasing, ensure you have the latest version of the `canary` branch and review the [SemVer](https://semver.org) specification to understand versioning.
|
||||
|
||||
### 1. Update the Version in `package.json`
|
||||
|
||||
```shell
|
||||
./scripts/set-version.sh 0.5.4-canary.5
|
||||
```
|
||||
|
||||
### 2. Commit Changes and Push to `canary`
|
||||
|
||||
```shell
|
||||
git add .
|
||||
# vX.Y.Z-canary.N
|
||||
git commit -m "v0.5.4-canary.5"
|
||||
git push origin canary
|
||||
```
|
||||
|
||||
### 3. Create a Release Action
|
||||
|
||||
Trigger a release action in the [Release Desktop App](https://github.com/toeverything/AFFiNE/actions/workflows/release-desktop-app.yml).
|
||||
|
||||

|
||||
|
||||
Select the appropriate branch, complete the form, and click `Run workflow`.
|
||||
|
||||
### 4. Publish the Release
|
||||
|
||||
Once the release action is complete, a draft release will appear on the [Releases page](https://github.com/toeverything/AFFiNE/releases).
|
||||
|
||||
Edit the release notes if necessary, then publish the release.
|
||||
|
||||
Ensure that:
|
||||
|
||||
- The release tag and title match the version in `package.json`.
|
||||
- The release targets the commit you just pushed.
|
||||
55
docs/contributing/tutorial.md
Normal file
55
docs/contributing/tutorial.md
Normal file
@@ -0,0 +1,55 @@
|
||||
# Tutorial
|
||||
|
||||
## Introduction
|
||||
|
||||
This tutorial will walk you through the codebase of AFFiNE. It is intended for new contributors to AFFiNE.
|
||||
|
||||
## Building the project
|
||||
|
||||
Make sure you know how to build the project. See [BUILDING](../BUILDING.md) for more information.
|
||||
|
||||
For the debugging purpose, you might need use local OctoBase on port 3000.
|
||||
|
||||
## Codebase overview
|
||||
|
||||
The codebase is organized as follows:
|
||||
|
||||
- `packages/` contains all code running in production.
|
||||
- `backend/` contains backend code, more information from <https://github.com/toeverything/OctoBase>.
|
||||
- `frontend/` contains frontend code, including the web app, the electron app and business libraries.
|
||||
- `common` contains the isomorphic code or basic libraries without business.
|
||||
- `tools/` contains tools to help developing or CI, not used in production.
|
||||
- `tests/` contains testings across different libraries, including e2e testings and integration testings.
|
||||
|
||||
### `@affine/env`
|
||||
|
||||
Environment setup for AFFiNE client side.
|
||||
|
||||
It includes the global constants, browser and system check.
|
||||
|
||||
This package should be imported at the very beginning of the entry point.
|
||||
|
||||
#### Design principles
|
||||
|
||||
- Each workspace plugin has its state and is isolated from other workspace plugins.
|
||||
- The workspace plugin is responsible for its own state management, data persistence, synchronization, data backup and recovery.
|
||||
|
||||
For the workspace API, see [types.ts](../../packages/frontend/workspace/src/type.ts).
|
||||
|
||||
### `@affine/component`
|
||||
|
||||
The UI component library for AFFiNE.
|
||||
|
||||
Each component should be a standalone component which can be used in any context, like the Storybook.
|
||||
|
||||
## Debugging Environments
|
||||
|
||||
### `@affine/env`
|
||||
|
||||
```shell
|
||||
yarn dev
|
||||
```
|
||||
|
||||
### `@affine/electron`
|
||||
|
||||
See [building desktop client app](../building-desktop-client-app.md).
|
||||
107
docs/developing-server.md
Normal file
107
docs/developing-server.md
Normal file
@@ -0,0 +1,107 @@
|
||||
This document explains how to start server (@affine/server) locally with Docker
|
||||
|
||||
> **Warning**:
|
||||
>
|
||||
> This document is not guaranteed to be up-to-date.
|
||||
> If you find any outdated information, please feel free to open an issue or submit a PR.
|
||||
|
||||
## Run required dev services in docker compose
|
||||
|
||||
Running yarn's server package (@affine/server) requires some dev services to be running, i.e.:
|
||||
|
||||
- postgres
|
||||
- redis
|
||||
- mailhog
|
||||
|
||||
You can run these services in docker compose by running the following command:
|
||||
|
||||
```sh
|
||||
cp ./.docker/dev/compose.yml.example ./.docker/dev/compose.yml
|
||||
cp ./.docker/dev/.env.example ./.docker/dev/.env
|
||||
|
||||
docker compose -f ./.docker/dev/compose.yml up
|
||||
```
|
||||
|
||||
### Notify
|
||||
|
||||
> Starting from AFFiNE 0.20, compose.yml includes a breaking change: the default database image has switched from `postgres:16` to `pgvector/pgvector:pg16`. If you were previously using another major version of Postgres, please change the number after `pgvector/pgvector:pg` to the major version you are using.
|
||||
|
||||
## Build native packages (you need to setup rust toolchain first)
|
||||
|
||||
Server also requires native packages to be built, you can build them by running the following command:
|
||||
|
||||
```sh
|
||||
# build native
|
||||
yarn affine @affine/server-native build
|
||||
```
|
||||
|
||||
## Prepare dev environment
|
||||
|
||||
```sh
|
||||
# uncomment all env variables here
|
||||
cp packages/backend/server/.env.example packages/backend/server/.env
|
||||
|
||||
# everytime there are new migrations, init command should runned again
|
||||
yarn affine server init
|
||||
```
|
||||
|
||||
## Start server
|
||||
|
||||
```sh
|
||||
# at project root
|
||||
yarn affine server dev
|
||||
```
|
||||
|
||||
when server started, it will created a default user and a pro user for testing:
|
||||
|
||||
### default user
|
||||
|
||||
Workspace members up to 3
|
||||
|
||||
- email: dev@affine.pro
|
||||
- name: Dev User
|
||||
- password: dev
|
||||
|
||||
### pro user
|
||||
|
||||
Workspace members up to 10
|
||||
|
||||
- email: pro@affine.pro
|
||||
- name: Pro User
|
||||
- password: pro
|
||||
|
||||
### team user
|
||||
|
||||
Include a default `Team Workspace` and the members up to 10
|
||||
|
||||
- email: team@affine.pro
|
||||
- name: Team User
|
||||
- password: team
|
||||
|
||||
## Start frontend
|
||||
|
||||
```sh
|
||||
# at project root
|
||||
yarn dev
|
||||
```
|
||||
|
||||
You can login with the user (dev@affine.pro / dev) above to test the server.
|
||||
|
||||
## Done
|
||||
|
||||
Now you should be able to start developing affine with server enabled.
|
||||
|
||||
## Bonus
|
||||
|
||||
### Enable prisma studio (Database GUI)
|
||||
|
||||
```sh
|
||||
# available at http://localhost:5555
|
||||
yarn affine server prisma studio
|
||||
```
|
||||
|
||||
### Seed the db
|
||||
|
||||
```sh
|
||||
yarn affine server seed -h
|
||||
```
|
||||
28
docs/issue-triaging.md
Normal file
28
docs/issue-triaging.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# Issues Triaging
|
||||
|
||||
When we receive your issue, we will first triaging it. Triaging an issue usually takes around one business day but may take longer. Goal of triaging is to provide you with a clear understanding of what will happen to your issue. For example, after your feature request was triaged you know whether we plan to tackle the issue or whether we'll wait to hear what the broader community thinks about this request.
|
||||
|
||||
Here are issue states and their descriptions:
|
||||
|
||||
| State | Description |
|
||||
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Untriaged | The team has not yet reviewed the issue. We usually do it within one business day. |
|
||||
| As designed | The behavior described in the issue is intentional. If you find it seriously disruptive or if we’ve misunderstood you, please let us know in the issue’s comments section. |
|
||||
| Blocked | We can’t work on this issue until another one (linked) is resolved. |
|
||||
| Can’t Reproduce | We have been unable to reproduce the issue on our side. It could be flaky or fixed already, or we may not have had all the details we needed. If you’re still experiencing the issue and have any further details, please share them. |
|
||||
| Duplicate | The issue is the same (or has the same cause) as another one (linked). |
|
||||
| Fixed | If the issue was a bug, it’s been fixed; if it was a missing feature, it’s been implemented. |
|
||||
| Fixed In Branch | If the issue was a bug, it’s been fixed; if it was a missing feature, it’s been implemented; the changes are now in a separate branch and haven’t been merged into the default branch yet. |
|
||||
| In Progress | We’re currently working on the issue. |
|
||||
| Incomplete | Unfortunately we don’t have enough information to proceed. If you’re willing to share any further details about the issue, please do so in the comments. |
|
||||
| Obsolete | The part of the product that was causing this issue has been removed or significantly reworked since it was created. |
|
||||
| Upvoting | We are currently evaluating demand for the issue and checking whether it requires complicated or risky changes. Please leave a vote or comment if you think it should be prioritized. |
|
||||
| Open | We want to implement the fix or feature in the near future. We can’t promise it will appear in the next public release, but it’s on our short list. |
|
||||
| Shelved | We have reviewed the issue and decided that, even though it has merit, we cannot currently include it in our near-term plan. |
|
||||
| Third Party Problem | The issue is caused by a third party. We've done our best to inform them about it. |
|
||||
| To be Discussed | We need some time to discuss the issue. |
|
||||
| To Reproduce | We will try to find the steps needed to reproduce the issue on our side. |
|
||||
| Under Investigation | We’ve triaged the issue, but now we need to investigate it more thoroughly. This may require processing additional information like logs or dumps. |
|
||||
| Waiting for Info | We’ve requested additional information from the person who created the issue and are waiting for them to get back to us. |
|
||||
| Declined | We’ve reviewed the suggestion and, while we appreciate its value, we unfortunately do not have the resources to implement it. |
|
||||
| Answered | The issue actually turned out to be a question or a misunderstanding, and it has been answered or resolved. |
|
||||
23
docs/reference/package.json
Normal file
23
docs/reference/package.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "@affine/docs",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "typedoc --options ../../typedoc.json",
|
||||
"dev": "nodemon --exec 'typedoc --options ../../typedoc.json' & serve dist/"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodemon": "^3.1.14",
|
||||
"serve": "^14.2.6",
|
||||
"typedoc": "^0.28.18"
|
||||
},
|
||||
"nodemonConfig": {
|
||||
"watch": [
|
||||
"./readme.md",
|
||||
"../../packages/*/*/src/*.ts",
|
||||
"../../**/typedoc{.base,}.json"
|
||||
],
|
||||
"ext": "ts,md,json"
|
||||
},
|
||||
"version": "0.27.5"
|
||||
}
|
||||
7
docs/reference/readme.md
Normal file
7
docs/reference/readme.md
Normal file
@@ -0,0 +1,7 @@
|
||||
Welcome to AFFiNE development reference.
|
||||
|
||||
This document is intended for developers who want to contribute to AFFiNE. It contains information about the architecture of AFFiNE, how to build it, and how to contribute to it.
|
||||
|
||||
### The Infrastructure of AFFiNE
|
||||
|
||||
see {@link @toeverything/infra!}
|
||||
29
docs/types-of-contributions.md
Normal file
29
docs/types-of-contributions.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Types of contributions :memo:
|
||||
|
||||
You can contribute to AFFiNE in several ways. This repo is a place to discuss and collaborate on AFFiNE!
|
||||
|
||||
### :mega: Discussions
|
||||
|
||||
Discussions are where we have conversations.
|
||||
|
||||
If you'd like help troubleshooting a docs PR you're working on, have a great new idea, or want to share something amazing you've learned in our docs, join us in [discussions](https://github.com/toeverything/AFFiNE/discussions).
|
||||
|
||||
### :lady_beetle: Issues
|
||||
|
||||
[Issues](https://docs.github.com/en/github/managing-your-work-on-github/about-issues) are used to track tasks that contributors can help with. If an issue has a triage label, we haven't reviewed it yet, and you shouldn't begin work on it.
|
||||
|
||||
If you've found something in the content or the website that should be updated, search open issues to see if someone else has reported the same thing. If it's something new, open an issue using a [template](https://github.com/toeverything/AFFiNE/issues/new/choose). We'll use the issue to have a conversation about the problem you want to fix.
|
||||
|
||||
### :hammer_and_wrench: Pull requests
|
||||
|
||||
A [pull request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests) is a way to suggest changes in our repository. When we merge those changes, they should be deployed to the live site within 24 hours. :earth_africa:
|
||||
You can [create a new pull request](https://github.com/toeverything/AFFiNE/compare) and view [current pull requests](https://github.com/toeverything/AFFiNE/pulls).
|
||||
|
||||
### :question: Support
|
||||
|
||||
We are a small team working hard to keep up with the documentation demands of a continuously changing product.
|
||||
You may be able to find additional help and information on our social media platforms and groups - the links to these can be found in our [README](../README.md).
|
||||
|
||||
### :earth_asia: Translations
|
||||
|
||||
AFFiNE is internationalized and available in multiple languages. The source content in this repository is written in English. We integrate with an external localization platform to work with the community in localizing the English content. You can find more info on our community page, in our [Discord](https://affine.pro/redirect/discord).
|
||||
Reference in New Issue
Block a user