docs: update BUILDING.md (#4087)

This commit is contained in:
Alex Yang 2023-08-31 18:50:54 -05:00 committed by GitHub
parent 25671e2134
commit 364fc517cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 28 deletions

View File

@ -31,11 +31,10 @@ install [Node LTS version](https://nodejs.org/en/download)
#### Option 2: Use node version manager #### Option 2: Use node version manager
install [nvm](https://github.com/nvm-sh/nvm) install [fnm](https://github.com/Schniz/fnm)
```sh ```sh
nvm install 18 fnm use
nvm use 18
``` ```
### Install Rust Tools ### Install Rust Tools
@ -68,29 +67,23 @@ Note: use `strip` from system instead of `binutils` if you are running MacOS. [s
yarn workspace @affine/native build yarn workspace @affine/native build
``` ```
### Build Infra
```sh
yarn run build:infra
```
### Build Plugins ### Build Plugins
``` ```sh
yarn run build:plugins yarn run build:plugins
``` ```
## Debugging the Electron App ### Build Server Dependencies
You need to run two scripts to run the app in development mode
Firstly, run the web app which is served at :8080
```sh
yarn workspace @affine/storage build
``` ```
yarn dev # you may want to chose `dev - 100.84.105.99:11001` when selecting the dev server
```
Secondly, bring up the electron app
```
yarn workspace @affine/electron dev
```
If everything goes well, you should see the AFFiNE App window popping up in a few seconds. 🎉
## Testing ## Testing
@ -98,16 +91,19 @@ Adding test cases is strongly encouraged when you contribute new features and bu
We use [Playwright](https://playwright.dev/) for E2E test, and [vitest](https://vitest.dev/) for unit test. We use [Playwright](https://playwright.dev/) for E2E test, and [vitest](https://vitest.dev/) for unit test.
To test locally, please make sure browser binaries are already installed via `npx playwright install`. To test locally, please make sure browser binaries are already installed via `npx playwright install`.
Also make sure you have built the `@affine/web` workspace before running E2E tests. Also make sure you have built the `@affine/core` workspace before running E2E tests.
### Unit Test
```sh ```sh
yarn build
# run tests in headless mode in another terminal window
yarn test yarn test
``` ```
## Troubleshooting ### E2E Test
> I ran `yarn start -p 8080` after `yarn build` but the index page returned 404. ```shell
# there are `affine-local`, `affine-legacy/*`, `affine-local`, `affine-plugin`, `affine-prototype` e2e tests,
Try stopping your development server (initialized by `yarn dev:local` or something) and running `yarn build` again. # which are run under different situations.
cd tests/affine-local
yarn e2e
```

View File

@ -18,7 +18,6 @@ Note that if you encounter any issues with installing Rust and crates, try follo
To run AFFiNE Desktop Client Application locally, run the following commands: To run AFFiNE Desktop Client Application locally, run the following commands:
```sh ```sh
# in repo root # in repo root
yarn install yarn install
yarn dev yarn dev
@ -27,7 +26,6 @@ yarn dev
yarn build yarn build
# in apps/electron # in apps/electron
yarn generate-assets
yarn dev yarn dev
``` ```