docs: update build guideline (#1630)

This commit is contained in:
Himself65 2023-03-21 00:12:42 -05:00 committed by GitHub
parent ee8303e5f0
commit 05ac48b693
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 13 deletions

View File

@ -3,8 +3,11 @@ name: Build & Test
on:
pull_request_target:
branches: [master]
# Cancels all previous workflow runs for pull requests that have not completed.
paths-ignore:
- '.husky'
- '.vscode'
- 'docs/**'
- 'README.md'
# See https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
# The concurrency group contains the workflow name and the branch name for

View File

@ -7,7 +7,7 @@
"module": "true",
"scripts": {
"dev:app": "NODE_ENV=development tauri dev",
"dev:web": "pnpm --filter @affine/app dev",
"dev:web": "yarn workspace @affine/app dev",
"build:rs-types": "zx scripts/generateTsTypingsFromJsonSchema.mjs",
"build:affine": "zx scripts/buildAffine.mjs",
"build:preload": "esbuild src/preload/index.ts --outdir=public/preload",

View File

@ -25,29 +25,49 @@ install [Node LTS version](https://nodejs.org/en/download)
install [nvm](https://github.com/nvm-sh/nvm)
```sh
nvm install --lts
nvm use --lts
nvm install 18
nvm use 18
```
## Setup Environment
```sh
# install dependencies
pnpm install
yarn install
```
## Start Development Server
```sh
pnpm dev
### Option 1: Local OctoBase
```shell
# Run OctoBase container in background
docker pull ghcr.io/toeverything/cloud:nightly-latest
docker run --env=SIGN_KEY=test123 --env=RUST_LOG=debug --env=JWST_DEV=1 --env=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --workdir=/app -p 3000:3000 --runtime=runc -d ghcr.io/toeverything/cloud:nightly-latest
```
The playground page should work at [http://localhost:8080/](http://localhost:8080/)
```shell
# Run AFFiNE Web in development mode
yarn dev:local
```
### Option 2: Remote OctoBase
```shell
yarn dev
```
you might need set environment variables in `.env.local` file.
See our [template](../apps/web/.env.local.template).
Then, the playground page should work at [http://localhost:8080/](http://localhost:8080/)
For more details, see [apps/web/README.md](../apps/web/README.md)
## Testing
> Local OctoBase is required for testing. Otherwise, the affine part of the tests will fail.
Adding test cases is strongly encouraged when you contribute new features and bug fixes.
We use [Playwright](https://playwright.dev/) for E2E test, and [vitest](https://vitest.dev/) for unit test.
@ -56,5 +76,5 @@ To test locally, please make sure browser binaries are already installed via `np
```sh
# run tests in headless mode in another terminal window
pnpm test
yarn test
```

View File

@ -19,9 +19,9 @@ To run AFFiNE Desktop Client Application locally, run the following commands in
```sh
pnpm install
pnpm build:preload
pnpm dev:app
yarn install
yarn build:preload
yarn dev:app
```