refactor(infra): directory structure (#4615)

This commit is contained in:
Joooye_34 2023-10-18 23:30:08 +08:00 committed by GitHub
parent 814d552be8
commit bed9310519
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1150 changed files with 539 additions and 584 deletions

View File

@ -7,10 +7,10 @@ affine-out
_next
lib
.eslintrc.js
packages/i18n/src/i18n-generated.ts
e2e-dist-*
static
web-static
public
packages/sdk/src/*.d.ts
packages/sdk/src/*.js
packages/common/sdk/src/*.d.ts
packages/common/sdk/src/*.js
packages/frontend/i18n/src/i18n-generated.ts

View File

@ -56,26 +56,25 @@ const createPattern = packageName => [
];
const allPackages = [
'packages/cli',
'packages/component',
'packages/debug',
'packages/env',
'packages/graphql',
'packages/hooks',
'packages/i18n',
'packages/native',
'packages/infra',
'packages/sdk',
'packages/templates',
'packages/theme',
'packages/workspace',
'packages/y-indexeddb',
'apps/web',
'apps/server',
'apps/electron',
'apps/storybook',
'plugins/copilot',
'plugins/bookmark-block',
'packages/backend/server',
'packages/frontend/component',
'packages/frontend/web',
'packages/frontend/electron',
'packages/frontend/graphql',
'packages/frontend/hooks',
'packages/frontend/i18n',
'packages/frontend/native',
'packages/frontend/templates',
'packages/frontend/workspace',
'packages/common/debug',
'packages/common/env',
'packages/common/infra',
'packages/common/sdk',
'packages/common/theme',
'packages/common/y-indexeddb',
'packages/plugins/copilot',
'tools/cli',
'tests/storybook',
];
/**
@ -88,7 +87,7 @@ const config = {
version: 'detect',
},
next: {
rootDir: 'apps/web',
rootDir: 'packages/frontend/core',
},
},
extends: [
@ -223,7 +222,7 @@ const config = {
},
overrides: [
{
files: 'apps/server/**/*.ts',
files: 'packages/backend/server/**/*.ts',
rules: {
'@typescript-eslint/consistent-type-imports': 0,
},

View File

@ -1,6 +1,6 @@
FROM openresty/openresty:1.21.4.1-0-buster
WORKDIR /app
COPY ./apps/core/dist ./dist
COPY ./packages/frontend/core/dist ./dist
COPY ./.github/deployment/front/nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
COPY ./.github/deployment/front/affine.nginx.conf /etc/nginx/conf.d/affine.nginx.conf

View File

@ -1,6 +1,6 @@
FROM node:18-bookworm-slim
COPY ./apps/server /app
COPY ./packages/backend/server /app
WORKDIR /app
RUN apt-get update && \

43
.github/labeler.yml vendored
View File

@ -1,7 +1,7 @@
docs:
- 'docs/**/*'
- '**/README.md'
- 'packages/templates/**/*'
- 'packages/frontend/templates/**/*'
test:
- 'tests/**/*'
@ -10,40 +10,37 @@ test:
mod:dev:
- 'scripts/**/*'
- 'packages/cli/**/*'
- 'packages/debug/**/*'
- 'tools/cli/**/*'
- 'packages/common/debug/**/*'
mod:plugin:
- 'plugins/**/*'
plugin:bookmark-block:
- 'plugins/bookmark-block/**/*'
- 'packages/plugins/**/*'
plugin:copilot:
- 'plugins/copilot/**/*'
- 'packages/plugins/copilot/**/*'
mod:infra:
- 'packages/infra/**/*'
- 'packages/common/infra/**/*'
mod:sdk:
- 'packages/sdk/**/*'
- 'packages/common/sdk/**/*'
mod:plugin-cli:
- 'packages/plugin-cli/**/*'
- 'tools/plugin-cli/**/*'
mod:workspace: 'packages/workspace/**/*'
mod:workspace: 'packages/frontend/workspace/**/*'
mod:i18n: 'packages/i18n/**/*'
mod:i18n: 'packages/frontend/i18n/**/*'
mod:env: 'packages/env/**/*'
mod:env: 'packages/common/env/**/*'
mod:hooks: 'packages/hooks/**/*'
mod:hooks: 'packages/frontend/hooks/**/*'
mod:component: 'packages/component/**/*'
mod:component: 'packages/frontend/component/**/*'
mod:storage: 'packages/storage/**/*'
mod:storage: 'packages/backend/storage/**/*'
mod:native: 'packages/native/**/*'
mod:native: 'packages/frontend/native/**/*'
mod:store:
- '**/atoms/**/*'
@ -56,12 +53,10 @@ rust:
- '**/rust-toolchain.toml'
- '**/rustfmt.toml'
package:y-indexeddb: 'packages/y-indexeddb/**/*'
package:y-indexeddb: 'packages/common/y-indexeddb/**/*'
app:core: 'apps/core/**/*'
app:core: 'packages/frontend/core/**/*'
app:electron: 'apps/electron/**/*'
app:electron: 'packages/frontend/electron/**/*'
app:server: 'apps/server/**/*'
app:docs: 'apps/docs/**/*'
app:server: 'packages/backend/server/**/*'

View File

@ -52,7 +52,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: core
path: ./apps/core/dist
path: ./packages/frontend/core/dist
if-no-files-found: error
build-native:
@ -72,7 +72,7 @@ jobs:
nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
- name: Run tests
run: yarn test
working-directory: ./packages/native
working-directory: ./packages/frontend/native
desktop-test:
name: Desktop Test
@ -137,7 +137,7 @@ jobs:
uses: actions/download-artifact@v3
with:
name: core
path: apps/electron/resources/web-static
path: packages/frontend/electron/resources/web-static
- name: Build Desktop Layers
run: yarn workspace @affine/electron build

View File

@ -60,7 +60,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: storage.node
path: ./packages/storage/storage.node
path: ./packages/backend/storage/storage.node
if-no-files-found: error
server-test:
@ -117,7 +117,7 @@ jobs:
uses: actions/download-artifact@v3
with:
name: storage.node
path: ./apps/server
path: ./packages/backend/server
- name: Run server tests
run: yarn workspace @affine/server test:coverage
@ -129,7 +129,7 @@ jobs:
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./apps/server/.coverage/lcov.info
files: ./packages/backend/server/.coverage/lcov.info
flags: server-test
name: affine
fail_ci_if_error: false
@ -188,7 +188,7 @@ jobs:
uses: actions/download-artifact@v3
with:
name: storage.node
path: ./apps/server
path: ./packages/backend/server
- name: Run playwright tests
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn workspace @affine-test/affine-cloud e2e --forbid-only
@ -278,7 +278,7 @@ jobs:
uses: actions/download-artifact@v3
with:
name: storage.node
path: ./apps/server
path: ./packages/backend/server
- name: Build Plugins
run: yarn run build:plugins

View File

@ -35,7 +35,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: server-dist
path: ./apps/server/dist
path: ./packages/backend/server/dist
if-no-files-found: error
build-core:
name: Build @affine/core
@ -62,7 +62,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: core
path: ./apps/core/dist
path: ./packages/frontend/core/dist
if-no-files-found: error
build-storage:
@ -84,7 +84,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: storage.node
path: ./packages/storage/storage.node
path: ./packages/backend/storage/storage.node
if-no-files-found: error
build-docker:
@ -101,17 +101,17 @@ jobs:
uses: actions/download-artifact@v3
with:
name: core
path: ./apps/core/dist
path: ./packages/frontend/core/dist
- name: Download server dist
uses: actions/download-artifact@v3
with:
name: server-dist
path: ./apps/server/dist
path: ./packages/backend/server/dist
- name: Download storage.node
uses: actions/download-artifact@v3
with:
name: storage.node
path: ./apps/server
path: ./packages/backend/server
- name: Setup env
run: |
echo "GIT_SHORT_HASH=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"

View File

@ -4,13 +4,13 @@ on:
push:
branches: ['master']
paths:
- 'packages/i18n/**'
- 'packages/frontend/i18n/**'
- '.github/workflows/languages-sync.yml'
- '!.github/actions/setup-node/action.yml'
pull_request_target:
branches: ['master']
paths:
- 'packages/i18n/**'
- 'packages/frontend/i18n/**'
- '.github/workflows/languages-sync.yml'
- '!.github/actions/setup-node/action.yml'
workflow_dispatch:

View File

@ -67,7 +67,7 @@ jobs:
- name: Replace Version
run: ./scripts/set-version.sh ${{ needs.set-build-version.outputs.version }}
- name: generate-assets
working-directory: apps/electron
working-directory: packages/frontend/electron
run: yarn generate-assets
env:
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
@ -80,7 +80,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: core
path: apps/electron/resources/web-static
path: packages/frontend/electron/resources/web-static
make-distribution:
environment: production
@ -133,7 +133,7 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: core
path: apps/electron/resources/web-static
path: packages/frontend/electron/resources/web-static
- name: Build Plugins
run: yarn run build:plugins
@ -155,23 +155,23 @@ jobs:
if: ${{ matrix.spec.platform == 'darwin' }}
run: |
mkdir -p builds
mv apps/electron/out/*/make/*.dmg ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.dmg
mv apps/electron/out/*/make/zip/darwin/${{ matrix.spec.arch }}/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.zip
mv packages/frontend/electron/out/*/make/*.dmg ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.dmg
mv packages/frontend/electron/out/*/make/zip/darwin/${{ matrix.spec.arch }}/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.zip
- name: Save artifacts (windows)
if: ${{ matrix.spec.platform == 'win32' }}
run: |
mkdir -p builds
mv apps/electron/out/*/make/zip/win32/x64/AFFiNE*-win32-x64-*.zip ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.zip
mv apps/electron/out/*/make/squirrel.windows/x64/*.exe ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.exe
mv apps/electron/out/*/make/squirrel.windows/x64/*.msi ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.msi
mv apps/electron/out/*/make/squirrel.windows/x64/*.nupkg ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.nupkg
mv packages/frontend/electron/out/*/make/zip/win32/x64/AFFiNE*-win32-x64-*.zip ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.zip
mv packages/frontend/electron/out/*/make/squirrel.windows/x64/*.exe ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.exe
mv packages/frontend/electron/out/*/make/squirrel.windows/x64/*.msi ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.msi
mv packages/frontend/electron/out/*/make/squirrel.windows/x64/*.nupkg ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.nupkg
- name: Save artifacts (linux)
if: ${{ matrix.spec.platform == 'linux' }}
run: |
mkdir -p builds
mv apps/electron/out/*/make/zip/linux/x64/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-linux-x64.zip
mv apps/electron/out/*/make/AppImage/x64/*.AppImage ./builds/affine-${{ env.BUILD_TYPE }}-linux-x64.AppImage
mv packages/frontend/electron/out/*/make/zip/linux/x64/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-linux-x64.zip
mv packages/frontend/electron/out/*/make/AppImage/x64/*.AppImage ./builds/affine-${{ env.BUILD_TYPE }}-linux-x64.AppImage
- name: Upload Artifact
uses: actions/upload-artifact@v3
@ -213,7 +213,7 @@ jobs:
node-version: 18
- name: Generate Release yml
run: |
node ./apps/electron/scripts/generate-yml.js
node ./packages/frontend/electron/scripts/generate-yml.js
env:
RELEASE_VERSION: ${{ needs.set-build-version.outputs.version }}
- name: Create Release Draft

View File

@ -14,9 +14,8 @@ on:
paths-ignore:
- README.md
- .github/**
- apps/server
- apps/docs
- apps/electron
- packages/backend/server
- packages/frontend/electron
- '!.github/workflows/publish-storybook.yml'
jobs:
@ -38,7 +37,7 @@ jobs:
run: yarn run build:plugins
- uses: chromaui/action-next@v1
with:
workingDir: apps/storybook
workingDir: tests/storybook
buildScriptName: build
exitOnceUploaded: true
onlyChanged: false

View File

@ -54,12 +54,12 @@ jobs:
if: ${{ github.ref_type == 'tag' }}
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
PACKAGE_VERSION=$(node -p "require('./apps/electron/package.json').version")
PACKAGE_VERSION=$(node -p "require('./packages/frontend/electron/package.json').version")
if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
echo "Tag version ($TAG_VERSION) does not match package.json version ($PACKAGE_VERSION)"
exit 1
fi
echo "RELEASE_VERSION=$(node -p "require('./apps/electron/package.json').version")" >> $GITHUB_OUTPUT
echo "RELEASE_VERSION=$(node -p "require('./packages/frontend/electron/package.json').version")" >> $GITHUB_OUTPUT
- name: generate-assets
run: yarn workspace @affine/electron generate-assets
env:
@ -73,7 +73,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: core
path: apps/electron/resources/web-static
path: packages/frontend/electron/resources/web-static
make-distribution:
environment: production
@ -123,7 +123,7 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: core
path: apps/electron/resources/web-static
path: packages/frontend/electron/resources/web-static
- name: Build Desktop Layers
run: yarn workspace @affine/electron build
@ -146,14 +146,14 @@ jobs:
if: ${{ matrix.spec.platform == 'darwin' }}
run: |
mkdir -p builds
mv apps/electron/out/*/make/*.dmg ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.dmg
mv apps/electron/out/*/make/zip/darwin/${{ matrix.spec.arch }}/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.zip
mv packages/frontend/electron/out/*/make/*.dmg ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.dmg
mv packages/frontend/electron/out/*/make/zip/darwin/${{ matrix.spec.arch }}/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.zip
- name: Save artifacts (linux)
if: ${{ matrix.spec.platform == 'linux' }}
run: |
mkdir -p builds
mv apps/electron/out/*/make/zip/linux/x64/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-linux-x64.zip
mv apps/electron/out/*/make/AppImage/x64/*.AppImage ./builds/affine-${{ env.BUILD_TYPE }}-linux-x64.AppImage
mv packages/frontend/electron/out/*/make/zip/linux/x64/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-linux-x64.zip
mv packages/frontend/electron/out/*/make/AppImage/x64/*.AppImage ./builds/affine-${{ env.BUILD_TYPE }}-linux-x64.AppImage
- name: Upload Artifact
uses: actions/upload-artifact@v3
@ -200,7 +200,7 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: core
path: apps/electron/resources/web-static
path: packages/frontend/electron/resources/web-static
- name: Build Plugins
run: yarn run build:plugins
@ -218,12 +218,12 @@ jobs:
- name: get all files to be signed
id: get_files_to_be_signed
run: |
Set-Variable -Name FILES_TO_BE_SIGNED -Value ((Get-ChildItem -Path apps/electron/out -Recurse -File | Where-Object { $_.Extension -in @(".exe", ".node", ".dll", ".msi") } | ForEach-Object { '"' + $_.FullName.Replace((Get-Location).Path + '\apps\electron\out\', '') + '"' }) -join ' ')
Set-Variable -Name FILES_TO_BE_SIGNED -Value ((Get-ChildItem -Path packages/frontend/electron/out -Recurse -File | Where-Object { $_.Extension -in @(".exe", ".node", ".dll", ".msi") } | ForEach-Object { '"' + $_.FullName.Replace((Get-Location).Path + '\apps\electron\out\', '') + '"' }) -join ' ')
"FILES_TO_BE_SIGNED=$FILES_TO_BE_SIGNED" >> $env:GITHUB_OUTPUT
echo $FILES_TO_BE_SIGNED
- name: Zip artifacts for faster upload
run: Compress-Archive -CompressionLevel Fastest -Path apps/electron/out/* -DestinationPath archive.zip
run: Compress-Archive -CompressionLevel Fastest -Path packages/frontend/electron/out/* -DestinationPath archive.zip
- name: Save packaged artifacts for signing
uses: actions/upload-artifact@v3
@ -266,18 +266,18 @@ jobs:
name: signed-packaged-${{ matrix.spec.platform }}-${{ matrix.spec.arch }}
path: .
- name: unzip file
run: Expand-Archive -Path signed.zip -DestinationPath apps/electron/out
run: Expand-Archive -Path signed.zip -DestinationPath packages/frontend/electron/out
- name: Make squirrel.windows installer
run: yarn workspace @affine/electron make-squirrel --platform=${{ matrix.spec.platform }} --arch=${{ matrix.spec.arch }}
- name: Zip artifacts for faster upload
run: Compress-Archive -CompressionLevel Fastest -Path apps/electron/out/${{ env.BUILD_TYPE }}/make/* -DestinationPath archive.zip
run: Compress-Archive -CompressionLevel Fastest -Path packages/frontend/electron/out/${{ env.BUILD_TYPE }}/make/* -DestinationPath archive.zip
- name: get all files to be signed
id: get_files_to_be_signed
run: |
Set-Variable -Name FILES_TO_BE_SIGNED -Value ((Get-ChildItem -Path apps/electron/out/${{ env.BUILD_TYPE }}/make -Recurse -File | Where-Object { $_.Extension -in @(".exe", ".node", ".dll", ".msi") } | ForEach-Object { '"' + $_.FullName.Replace((Get-Location).Path + '\apps\electron\out\${{ env.BUILD_TYPE }}\make\', '') + '"' }) -join ' ')
Set-Variable -Name FILES_TO_BE_SIGNED -Value ((Get-ChildItem -Path packages/frontend/electron/out/${{ env.BUILD_TYPE }}/make -Recurse -File | Where-Object { $_.Extension -in @(".exe", ".node", ".dll", ".msi") } | ForEach-Object { '"' + $_.FullName.Replace((Get-Location).Path + '\apps\electron\out\${{ env.BUILD_TYPE }}\make\', '') + '"' }) -join ' ')
"FILES_TO_BE_SIGNED=$FILES_TO_BE_SIGNED" >> $env:GITHUB_OUTPUT
echo $FILES_TO_BE_SIGNED
@ -314,14 +314,14 @@ jobs:
name: signed-installer-${{ matrix.spec.platform }}-${{ matrix.spec.arch }}
path: .
- name: unzip file
run: Expand-Archive -Path signed.zip -DestinationPath apps/electron/out/${{ env.BUILD_TYPE }}/make
run: Expand-Archive -Path signed.zip -DestinationPath packages/frontend/electron/out/${{ env.BUILD_TYPE }}/make
- name: Save artifacts
run: |
mkdir -p builds
mv apps/electron/out/*/make/zip/win32/x64/AFFiNE*-win32-x64-*.zip ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.zip
mv apps/electron/out/*/make/squirrel.windows/x64/*.exe ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.exe
mv apps/electron/out/*/make/squirrel.windows/x64/*.msi ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.msi
mv packages/frontend/electron/out/*/make/zip/win32/x64/AFFiNE*-win32-x64-*.zip ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.zip
mv packages/frontend/electron/out/*/make/squirrel.windows/x64/*.exe ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.exe
mv packages/frontend/electron/out/*/make/squirrel.windows/x64/*.msi ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.msi
- name: Upload Artifact
uses: actions/upload-artifact@v3
@ -366,7 +366,7 @@ jobs:
node-version: 18
- name: Generate Release yml
run: |
node ./apps/electron/scripts/generate-yml.js
node ./packages/frontend/electron/scripts/generate-yml.js
env:
RELEASE_VERSION: ${{ github.event.inputs.version || needs.before-make.outputs.RELEASE_VERSION }}
- name: Create Release Draft

View File

@ -42,7 +42,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: core
path: ./apps/core/dist
path: ./packages/frontend/core/dist
if-no-files-found: error
build-server:
@ -61,7 +61,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: server-dist
path: ./apps/server/dist
path: ./packages/backend/server/dist
if-no-files-found: error
build-storage:
@ -85,7 +85,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: storage.node
path: ./packages/storage/storage.node
path: ./packages/backend/storage/storage.node
if-no-files-found: error
build-docker:
@ -102,17 +102,17 @@ jobs:
uses: actions/download-artifact@v3
with:
name: core
path: ./apps/core/dist
path: ./packages/frontend/core/dist
- name: Download server dist
uses: actions/download-artifact@v3
with:
name: server-dist
path: ./apps/server/dist
path: ./packages/backend/server/dist
- name: Download storage.node
uses: actions/download-artifact@v3
with:
name: storage.node
path: ./apps/server
path: ./packages/backend/server
- name: Setup Git short hash
run: |
echo "GIT_SHORT_HASH=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"

View File

@ -5,7 +5,7 @@ on:
branches:
- master
paths:
- packages/workers/**
- tools/workers/**
jobs:
deploy:
@ -19,4 +19,4 @@ jobs:
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
workingDirectory: 'packages/workers'
workingDirectory: 'tools/workers'

View File

@ -3,8 +3,8 @@
"version": 1,
"list": [
{
"input": "./packages/i18n/src/resources/en.json",
"output": "./packages/i18n/src/i18n-generated",
"input": "./packages/frontend/i18n/src/resources/en.json",
"output": "./packages/frontend/i18n/src/i18n-generated",
"parser": {
"type": "i18next",
"contextSeparator": "$",

View File

@ -2,16 +2,16 @@ yarn.lock
target
lib
test-results
packages/i18n/src/i18n-generated.ts
packages/graphql/src/graphql/index.ts
.next
out
dist
.yarn
tests/affine-legacy/**/static
.github/helm
_next
storybook-static
web-static
public
apps/server/src/schema.gql
packages/backend/server/src/schema.gql
packages/frontend/i18n/src/i18n-generated.ts
packages/frontend/graphql/src/graphql/index.ts
tests/affine-legacy/**/static

View File

@ -29,15 +29,7 @@
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"vitest.include": [
"packages/**/*.spec.ts",
"packages/**/*.spec.tsx",
"apps/web/**/*.spec.ts",
"apps/web/**/*.spec.tsx",
"apps/electron/src/**/*.spec.ts",
"tests/unit/**/*.spec.ts",
"tests/unit/**/*.spec.tsx"
],
"vitest.include": ["packages/**/*.spec.ts", "packages/**/*.spec.tsx"],
"rust-analyzer.check.extraEnv": {
"DATABASE_URL": "sqlite:affine.db"
}

View File

@ -1,9 +1,9 @@
[workspace]
resolver = "2"
members = [
"./packages/native",
"./packages/native/schema",
"./packages/storage",
"./packages/frontend/native",
"./packages/frontend/native/schema",
"./packages/backend/storage",
]
[profile.dev.package.sqlx-macros]

View File

@ -2,7 +2,7 @@ Copyright (c) 2022-present TOEVERYTHING PTE. LTD. and its affiliates.
Portions of this software are licensed as follows:
- All content that resides under the "apps/server" directory of this repository, if that directory exists, is licensed under the license defined in "apps/server/LICENSE".
- All content that resides under the "packages/backend/server" directory of this repository, if that directory exists, is licensed under the license defined in "packages/backend/server/LICENSE".
- All third party components incorporated into the AFFiNE Software are licensed under the original license provided by the owner of the applicable component.
- Content outside of the above mentioned directories or restrictions above is available under the "MIT" license as defined in "LICENSE-MIT".

View File

@ -110,9 +110,9 @@ If you have questions, you are welcome to contact us. One of the best places to
| Name | | |
| ----------------------------------------------------------------------------------------------- | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| [@toeverything/component](https://github.com/toeverything/design/tree/main/packages/components) | Toeverything Shared Component Resources | |
| [@affine/component](packages/component) | AFFiNE Component Resources | [![](https://img.shields.io/codecov/c/github/toeverything/affine?style=flat-square)](https://affine-storybook.vercel.app/) |
| [@toeverything/y-indexeddb](packages/y-indexeddb) | IndexedDB database adapter for Yjs | [![](https://img.shields.io/npm/dm/@toeverything/y-indexeddb?style=flat-square&color=eee)](https://www.npmjs.com/package/@toeverything/y-indexeddb) |
| [@toeverything/theme](packages/theme) | AFFiNE theme | [![](https://img.shields.io/npm/dm/@toeverything/theme?style=flat-square&color=eee)](https://www.npmjs.com/package/@toeverything/theme) |
| [@affine/component](packages/frontend/component) | AFFiNE Component Resources | [![](https://img.shields.io/codecov/c/github/toeverything/affine?style=flat-square)](https://affine-storybook.vercel.app/) |
| [@toeverything/y-indexeddb](packages/common/y-indexeddb) | IndexedDB database adapter for Yjs | [![](https://img.shields.io/npm/dm/@toeverything/y-indexeddb?style=flat-square&color=eee)](https://www.npmjs.com/package/@toeverything/y-indexeddb) |
| [@toeverything/theme](packages/common/theme) | AFFiNE theme | [![](https://img.shields.io/npm/dm/@toeverything/theme?style=flat-square&color=eee)](https://www.npmjs.com/package/@toeverything/theme) |
## Plugins
@ -120,8 +120,8 @@ If you have questions, you are welcome to contact us. One of the best places to
>
> (Currently, the plugin system is under heavy development. You will see the plugin system in the canary release.)
- [@affine/sdk](./packages/sdk) - SDK for developing plugins
- [@affine/plugin-cli](./packages/plugin-cli) - CLI for developing plugins
- [@affine/sdk](./packages/common/sdk) - SDK for developing plugins
- [@affine/plugin-cli](./tools/plugin-cli) - CLI for developing plugins
| Official Plugin | Description | Status |
| ----------------------------------------------------- | ----------------------------------------- | ------ |

View File

@ -1,29 +0,0 @@
# Apps structure
> This is the structure of the `apps` directory.
## docs
AFFiNE Developer Documentation using [waku](https://github.com/dai-shi/waku).
## electron
> `core` needs to be built before electron.
AFFiNE Desktop (macOS, Linux and Windows Distribution) using [Electron](https://www.electronjs.org/).
## server
Server using [Nest.js](https://nestjs.com/).
## storybook
Storybook using [Storybook](https://storybook.js.org/).
## prototype
AFFiNE Prototype using [React.js](https://reactjs.org/) + [Vite](https://vitejs.dev/).
## core
AFFiNE Core Application using [React.js](https://reactjs.org/) + [Webpack](https://webpack.js.org/).

View File

@ -59,7 +59,7 @@ yarn install
### Build Native Dependencies
Run the following script. It will build the native module at [`/packages/native`](/packages/native) and build Node.js binding using [NAPI.rs](https://napi.rs/).
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.
Note: use `strip` from system instead of `binutils` if you are running MacOS. [see problem here](https://github.com/toeverything/AFFiNE/discussions/2840)

View File

@ -22,10 +22,10 @@ To run AFFiNE Desktop Client Application locally, run the following commands:
yarn install
yarn dev
# in packages/native
# in packages/frontend/native
yarn build
# in apps/electron
# in packages/frontend/electron
yarn dev
```
@ -33,7 +33,7 @@ Now you should see the Electron app window popping up shortly.
## Build
To build the desktop client application, run `yarn make` in `apps/electron`.
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.
@ -41,7 +41,7 @@ Once the build is complete, you can find the paths to the binaries in the termin
```
Finished 2 bundles at:
Artifacts available at: <affine-repo>/apps/electron/out/make
Artifacts available at: <affine-repo>/packages/frontend/electron/out/make
```
## CI

View File

@ -14,21 +14,13 @@ For the debugging purpose, you might need use local OctoBase on port 3000.
The codebase is organized as follows:
- `apps/` contains the source code for the different entry points of the project.
- `web/` contains the source code for the web app.
- `electron/` contains the source code for the Electron app.
- `server/` backend side for AFFiNE, see <https://github.com/toeverything/OctoBase> instead.
- `packages/` contains the source code for all the packages in the repo.
- `cli` contains the source code for the CLI. Development only.
- `component` contains the source code for the UI component library.
- `debug` contains the source code for the debug helper.
- `env` contains the source code for the environment setup.
- `hooks` contains the source code for the custom React hooks.
- `i18n` contains the source code for the internationalization.
- `jotai` contains the source code for the Jotai store atoms.
- `octobase-node` contains the source code for the OctoBase Node.js binding using Rust.
- `templates` contains the source code for the templates.
- `workspace` contains the source code for the workspace related code.
- `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.
- `plugins/` contains all build-in plugins.
- `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`
@ -50,7 +42,7 @@ Current we have two workspace plugin:
- 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/workspace/src/type.ts).
For the workspace API, see [types.ts](../../packages/frontend/workspace/src/type.ts).
### `@affine/component`

View File

@ -47,7 +47,7 @@ postgres=# \du
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
```
### Set the following config to `apps/server/.env`
### Set the following config to `packages/backend/server/.env`
```
DATABASE_URL="postgresql://affine:affine@localhost:5432/affine"

View File

@ -6,20 +6,13 @@
"license": "MIT",
"workspaces": [
".",
"apps/*",
"plugins/*",
"packages/*",
"packages/@types/*",
"tests/fixtures",
"tests/kit",
"tests/affine-legacy/*",
"tests/affine-local",
"tests/affine-migration",
"tests/affine-desktop",
"tests/affine-desktop-cloud",
"tests/affine-plugin",
"tests/affine-prototype",
"tests/affine-cloud"
"packages/*/*",
"tools/*",
"!tools/@types",
"tools/@types/*",
"tests/*",
"!tests/affine-legacy",
"tests/affine-legacy/*"
],
"engines": {
"node": ">=18.16.1 <19.0.0"
@ -34,7 +27,7 @@
"build:plugins": "yarn nx run-many -t build --projects=tag:plugin",
"build:storybook": "yarn nx build @affine/storybook",
"start:web-static": "yarn workspace @affine/core static-server",
"start:storybook": "yarn exec serve apps/storybook/storybook-static -l 6006",
"start:storybook": "yarn exec serve tests/storybook/storybook-static -l 6006",
"serve:test-static": "yarn exec serve tests/fixtures --cors -p 8081",
"lint:eslint": "eslint . --ext .js,mjs,.ts,.tsx --cache",
"lint:eslint:fix": "yarn lint:eslint --fix",
@ -46,7 +39,7 @@
"test:ui": "vitest --ui",
"test:coverage": "vitest run --coverage",
"notify": "node scripts/notify.mjs",
"circular": "madge --circular --ts-config ./tsconfig.json ./apps/core/src/pages/**/*.tsx ./apps/core/src/index.tsx ./apps/electron/src/*/index.ts",
"circular": "madge --circular --ts-config ./tsconfig.json ./packages/frontend/core/src/pages/**/*.tsx ./packages/frontend/core/src/index.tsx ./packages/frontend/electron/src/*/index.ts",
"typecheck": "tsc -b tsconfig.json --diagnostics",
"postinstall": "node ./scripts/check-version.mjs && yarn i18n-codegen gen && yarn husky install"
},

Some files were not shown because too many files have changed in this diff Show More