Total Pageviews

Monday, 15 January 2024

AFFiNE 是个知识库,集存储、集成、管理和创建工作流于一体


v0.1.0 于 2022 年 7 月发布, 9 月就庆祝 GitHub 达到了 1w 星星。
AFFiNE 官网上的的广告词:Notion/Miro/Monday 的开源替代版。感谢友商,不用过多介绍 AFFiNE,大多数人已经基本清楚七八分它是做啥的了吧。
另外,广告词的另一部分 "Privacy First",也是 AFFiNE 主打的一点:与 Notion 不同,用户可以自己部署 AFFiNE,对自己的数据拥有完全掌控。 

 https://github.com/toeverything/AFFiNE

 https://affine.pro/

--------------------------------------------------------

Building AFFiNE Web

Warning:

This document has not been updated for a while. If you find any outdated information, please feel free to open an issue or submit a PR.

Note For developing & building desktop client app, please refer to building-desktop-client-app.md

Table of Contents

Prerequisites

AFFiNE client has both Node.js & Rust toolchains.

Install Node.js

We suggest develop our product under node.js LTS(Long-term support) version

Option 1: Manually install node.js

install Node LTS version

Up to now, the major node.js version is 18.x

Option 2: Use node version manager

install fnm

fnm use

Install Rust Tools

Please follow the official guide at https://www.rust-lang.org/tools/install.

Setup Node.js Environment

This setup requires modern yarn (currently 4.x), run this if your yarn version is 1.x

Reference: Yarn installation doc

corepack enable
corepack prepare yarn@stable --activate
# install dependencies
yarn install

Clone repository

Linux & MacOS

git clone https://github.com/toeverything/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.

For detailed guidance on enabling this feature, please refer to the official documentation: Enable Developer Mode on Windows.

Once Developer Mode is enabled, execute the following command with administrator privileges:

# Enable symbolic links
git config --global core.symlinks true
# Clone the repository, also need to be run with administrator privileges
git clone https://github.com/toeverything/AFFiNE

Build Native Dependencies

Run the following script. It will build the native module at /packages/frontend/native and build Node.js binding using NAPI.rs. This could take a while if you build it for the first time. Note: use strip from system instead of binutils if you are running MacOS. see problem here

yarn workspace @affine/native build

Build Server Dependencies

yarn workspace @affine/storage build

Testing

Adding test cases is strongly encouraged when you contribute new features and bug fixes.

We use Playwright for E2E test, and vitest for unit test. To test locally, please make sure browser binaries are already installed via npx playwright install. Also make sure you have built the @affine/core workspace before running E2E tests.

Unit Test

yarn test

E2E Test

# there are `affine-local`, `affine-migration`, `affine-local`, `affine-prototype` e2e tests,
#   which are run under different situations.
cd tests/affine-local
yarn e2e
from https://github.com/toeverything/AFFiNE/blob/canary/docs/BUILDING.md
-----

Building AFFiNE Desktop Client App

Table of Contents

Prerequisites

Before you start building AFFiNE Desktop Client Application, please install Rust toolchain first.

Note that if you encounter any issues with installing Rust and crates, try following this guide (zh-CN) to set up alternative registries.

Development

To run AFFiNE Desktop Client Application locally, run the following commands:

# in repo root
yarn install
yarn dev

# in packages/frontend/native
yarn build

# in packages/frontend/electron
yarn dev

Now you should see the Electron app window popping up shortly.

Build

To build the desktop client application, run yarn make in packages/frontend/electron.

Note: you may want to comment out osxSign and osxNotarize in forge.config.js to avoid signing and notarizing the app.

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/electron/out/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

from https://github.com/toeverything/AFFiNE/blob/canary/docs/building-desktop-client-app.md

 

 


No comments:

Post a Comment