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
4 changed files with 36 additions and 13 deletions

View File

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

View File

@@ -7,7 +7,7 @@
"module": "true", "module": "true",
"scripts": { "scripts": {
"dev:app": "NODE_ENV=development tauri dev", "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:rs-types": "zx scripts/generateTsTypingsFromJsonSchema.mjs",
"build:affine": "zx scripts/buildAffine.mjs", "build:affine": "zx scripts/buildAffine.mjs",
"build:preload": "esbuild src/preload/index.ts --outdir=public/preload", "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) install [nvm](https://github.com/nvm-sh/nvm)
```sh ```sh
nvm install --lts nvm install 18
nvm use --lts nvm use 18
``` ```
## Setup Environment ## Setup Environment
```sh ```sh
# install dependencies # install dependencies
pnpm install yarn install
``` ```
## Start Development Server ## Start Development Server
```sh ### Option 1: Local OctoBase
pnpm dev
```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) For more details, see [apps/web/README.md](../apps/web/README.md)
## Testing ## 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. 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. 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 ```sh
# run tests in headless mode in another terminal window # 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 ```sh
pnpm install yarn install
pnpm build:preload yarn build:preload
pnpm dev:app yarn dev:app
``` ```