ci: speedup ci by reduce installation packages in certain job (#4457)

This commit is contained in:
LongYinan
2023-09-29 11:02:26 +08:00
committed by GitHub
parent b012e615ba
commit dd94ea5b45
84 changed files with 2954 additions and 2271 deletions

View File

@@ -34,7 +34,7 @@ runs:
if: ${{ inputs.target != 'x86_64-unknown-linux-gnu' && inputs.target != 'aarch64-unknown-linux-gnu' }} if: ${{ inputs.target != 'x86_64-unknown-linux-gnu' && inputs.target != 'aarch64-unknown-linux-gnu' }}
shell: bash shell: bash
run: | run: |
yarn nx build ${{ inputs.package }} --target ${{ inputs.target }} yarn workspace ${{ inputs.package }} nx build ${{ inputs.package }} --target ${{ inputs.target }}
env: env:
NX_CLOUD_ACCESS_TOKEN: ${{ inputs.nx_token }} NX_CLOUD_ACCESS_TOKEN: ${{ inputs.nx_token }}
@@ -48,7 +48,7 @@ runs:
export CC=x86_64-unknown-linux-gnu-gcc export CC=x86_64-unknown-linux-gnu-gcc
export CC_x86_64_unknown_linux_gnu=x86_64-unknown-linux-gnu-gcc export CC_x86_64_unknown_linux_gnu=x86_64-unknown-linux-gnu-gcc
export RUSTFLAGS="-C debuginfo=1" export RUSTFLAGS="-C debuginfo=1"
yarn nx build ${{ inputs.package }} --target ${{ inputs.target }} yarn workspace ${{ inputs.package }} nx build ${{ inputs.package }} --target ${{ inputs.target }}
chmod -R 777 node_modules/.cache chmod -R 777 node_modules/.cache
chmod -R 777 target chmod -R 777 target
@@ -60,6 +60,6 @@ runs:
options: --user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build -e NX_CLOUD_ACCESS_TOKEN=${{ inputs.nx_token }} options: --user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build -e NX_CLOUD_ACCESS_TOKEN=${{ inputs.nx_token }}
run: | run: |
export RUSTFLAGS="-C debuginfo=1" export RUSTFLAGS="-C debuginfo=1"
yarn nx build ${{ inputs.package }} --target ${{ inputs.target }} yarn workspace ${{ inputs.package }} nx build ${{ inputs.package }} --target ${{ inputs.target }}
chmod -R 777 node_modules/.cache chmod -R 777 node_modules/.cache
chmod -R 777 target chmod -R 777 target

View File

@@ -7,8 +7,7 @@ runs:
- name: 'Install @electron-forge/maker-dmg' - name: 'Install @electron-forge/maker-dmg'
if: runner.os == 'macos' if: runner.os == 'macos'
shell: bash shell: bash
working-directory: ./apps/electron run: yarn workspace @affine/electron add @electron-forge/maker-dmg --dev
run: yarn add @electron-forge/maker-dmg --dev
env: env:
HUSKY: '0' HUSKY: '0'
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'

View File

@@ -21,6 +21,14 @@ inputs:
description: 'set nmMode to hardlinks-local in .yarnrc.yml' description: 'set nmMode to hardlinks-local in .yarnrc.yml'
required: false required: false
default: 'true' default: 'true'
build-infra:
description: 'Build infra'
required: false
default: 'true'
build-plugins:
description: 'Build plugins'
required: false
default: 'true'
runs: runs:
using: 'composite' using: 'composite'
@@ -42,7 +50,7 @@ runs:
if: ${{ inputs.package-install == 'true' }} if: ${{ inputs.package-install == 'true' }}
continue-on-error: true continue-on-error: true
shell: bash shell: bash
run: yarn install ${{ inputs.extra-flags }} run: yarn ${{ inputs.extra-flags }}
env: env:
HUSKY: '0' HUSKY: '0'
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
@@ -52,7 +60,7 @@ runs:
- name: yarn install (try again) - name: yarn install (try again)
if: ${{ steps.install.outcome == 'failure' }} if: ${{ steps.install.outcome == 'failure' }}
shell: bash shell: bash
run: yarn install ${{ inputs.extra-flags }} run: yarn ${{ inputs.extra-flags }}
env: env:
HUSKY: '0' HUSKY: '0'
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
@@ -89,11 +97,11 @@ runs:
${{ runner.os }}-${{ runner.arch }}-playwright- ${{ runner.os }}-${{ runner.arch }}-playwright-
# If the Playwright browser binaries weren't able to be restored, we tell # If the Playwright browser binaries weren't able to be restored, we tell
# paywright to install everything for us. # playwright to install everything for us.
- name: Install Playwright's dependencies - name: Install Playwright's dependencies
shell: bash shell: bash
if: inputs.playwright-install == 'true' && steps.playwright-cache.outputs.cache-hit != 'true' if: inputs.playwright-install == 'true'
run: yarn playwright install --with-deps run: yarn playwright install --with-deps chromium
- name: Get installed Electron version - name: Get installed Electron version
id: electron-version id: electron-version
@@ -114,14 +122,16 @@ runs:
- name: Install Electron binary - name: Install Electron binary
shell: bash shell: bash
if: inputs.electron-install == 'true' if: inputs.electron-install == 'true'
run: node apps/electron/node_modules/electron/install.js run: node ./node_modules/electron/install.js
env: env:
ELECTRON_OVERRIDE_DIST_PATH: ./node_modules/.cache/electron ELECTRON_OVERRIDE_DIST_PATH: ./node_modules/.cache/electron
- name: Build Infra - name: Build Infra
shell: bash shell: bash
if: inputs.build-infra == 'true'
run: yarn run build:infra run: yarn run build:infra
- name: Build Plugins - name: Build Plugins
if: inputs.build-plugins == 'true'
shell: bash shell: bash
run: yarn run build:plugins run: yarn run build:plugins

View File

@@ -41,11 +41,11 @@ jobs:
environment: development environment: development
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
- name: Build Plugins with:
run: yarn run build:plugins electron-install: false
- name: Build Core - name: Build Core
run: yarn nx build @affine/core run: yarn nx build @affine/core
- name: Upload core artifact - name: Upload core artifact
@@ -94,11 +94,12 @@ jobs:
} }
needs: build-core needs: build-core
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
timeout-minutes: 10 timeout-minutes: 10
with: with:
extra-flags: workspaces focus @affine/electron @affine/monorepo @affine-test/affine-desktop
playwright-install: true playwright-install: true
hard-link-nm: false hard-link-nm: false
@@ -111,8 +112,7 @@ jobs:
- name: Run unit tests - name: Run unit tests
if: ${{ matrix.spec.test }} if: ${{ matrix.spec.test }}
shell: bash shell: bash
run: yarn vitest run: yarn workspace @affine/electron vitest
working-directory: ./apps/electron
- name: Download core artifact - name: Download core artifact
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
@@ -120,9 +120,6 @@ jobs:
name: core name: core
path: apps/electron/resources/web-static path: apps/electron/resources/web-static
- name: Build Plugins
run: yarn run build:plugins
- name: Build Desktop Layers - name: Build Desktop Layers
run: yarn workspace @affine/electron build run: yarn workspace @affine/electron build
@@ -142,13 +139,13 @@ jobs:
if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }} if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }}
env: env:
SKIP_BUNDLE: true SKIP_BUNDLE: true
SKIP_WEB_BUILD: true
run: yarn workspace @affine/electron make --platform=darwin --arch=arm64 run: yarn workspace @affine/electron make --platform=darwin --arch=arm64
- name: Output check - name: Output check
if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }} if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }}
run: | run: |
yarn ts-node-esm ./scripts/macos-arm64-output-check.mts yarn workspace @affine/electron ts-node-esm ./scripts/macos-arm64-output-check.mts
working-directory: apps/electron
- name: Collect code coverage report - name: Collect code coverage report
if: ${{ matrix.spec.test }} if: ${{ matrix.spec.test }}

View File

@@ -42,10 +42,15 @@ jobs:
environment: development environment: development
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
- name: Setup Rust with:
extra-flags: workspaces focus @affine/storage
electron-install: false
build-infra: false
build-plugins: false
- name: Build Rust
uses: ./.github/actions/build-rust uses: ./.github/actions/build-rust
with: with:
target: 'x86_64-unknown-linux-gnu' target: 'x86_64-unknown-linux-gnu'
@@ -81,10 +86,12 @@ jobs:
- 1025:1025 - 1025:1025
- 8025:8025 - 8025:8025
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
with:
electron-install: false
- name: Initialize database - name: Initialize database
run: | run: |
@@ -150,7 +157,7 @@ jobs:
- 1025:1025 - 1025:1025
- 8025:8025 - 8025:8025
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
@@ -232,7 +239,7 @@ jobs:
- 1025:1025 - 1025:1025
- 8025:8025 - 8025:8025
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
@@ -257,15 +264,13 @@ jobs:
- name: Generate prisma client - name: Generate prisma client
run: | run: |
yarn exec prisma generate yarn workspace @affine/server exec prisma generate
yarn exec prisma db push yarn workspace @affine/server prisma db push
working-directory: apps/server
env: env:
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine DATABASE_URL: postgresql://affine:affine@localhost:5432/affine
- name: Run init-db script - name: Run init-db script
run: yarn exec ts-node-esm ./scripts/init-db.ts run: yarn workspace @affine/server exec ts-node-esm ./scripts/init-db.ts
working-directory: apps/server
env: env:
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine DATABASE_URL: postgresql://affine:affine@localhost:5432/affine

View File

@@ -42,7 +42,7 @@ jobs:
environment: development environment: development
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
with: with:
@@ -66,7 +66,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: development environment: development
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Run check - name: Run check
run: | run: |
yarn set version $(node -e "console.log(require('./package.json').packageManager.split('@')[1])") yarn set version $(node -e "console.log(require('./package.json').packageManager.split('@')[1])")
@@ -77,7 +77,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: development environment: development
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
with: with:
@@ -117,7 +117,7 @@ jobs:
shard: [1, 2, 3, 4, 5] shard: [1, 2, 3, 4, 5]
environment: development environment: development
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
with: with:
@@ -159,9 +159,9 @@ jobs:
spec: spec:
- { package: 0.7.0-canary.18 } - { package: 0.7.0-canary.18 }
- { package: 0.8.0-canary.7 } - { package: 0.8.0-canary.7 }
- { package: 0.8.3 } - { package: 0.8.4 }
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
with: with:
@@ -169,12 +169,10 @@ jobs:
electron-install: false electron-install: false
- name: Unzip - name: Unzip
run: yarn unzip run: yarn workspace @affine-legacy/${{ matrix.spec.package }} unzip
working-directory: ./tests/affine-legacy/${{ matrix.spec.package }}
- name: Run playwright tests - name: Run playwright tests
run: yarn e2e --forbid-only run: yarn workspace @affine-legacy/${{ matrix.spec.package }} e2e --forbid-only
working-directory: ./tests/affine-legacy/${{ matrix.spec.package }}
- name: Upload test results - name: Upload test results
if: ${{ failure() }} if: ${{ failure() }}
@@ -189,7 +187,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: development environment: development
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
with: with:

View File

@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out code - name: Check out code
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Cleanup - name: Cleanup
run: | run: |

View File

@@ -37,7 +37,7 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL

View File

@@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: ${{ github.event.inputs.flavor }} environment: ${{ github.event.inputs.flavor }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
with: with:
@@ -43,7 +43,7 @@ jobs:
environment: production environment: production
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
- name: Build Plugins - name: Build Plugins
@@ -70,7 +70,7 @@ jobs:
environment: ${{ github.event.inputs.flavor }} environment: ${{ github.event.inputs.flavor }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
- name: Setup Rust - name: Setup Rust
@@ -95,7 +95,7 @@ jobs:
- build-core - build-core
- build-storage - build-storage
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Download core artifact - name: Download core artifact
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
@@ -180,7 +180,7 @@ jobs:
- build-docker - build-docker
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Deploy to dev - name: Deploy to dev
uses: ./.github/actions/deploy uses: ./.github/actions/deploy
with: with:

View File

@@ -11,12 +11,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Checkout Helm chart repo - name: Checkout Helm chart repo
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
repository: toeverything/helm-charts repository: toeverything/helm-charts
path: .helm-chart-repo path: .helm-chart-repo

View File

@@ -19,7 +19,7 @@ jobs:
main: main:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
- name: Check Language Key - name: Check Language Key

View File

@@ -36,7 +36,7 @@ jobs:
outputs: outputs:
version: 0.0.0-internal.${{ steps.version.outputs.version }} version: 0.0.0-internal.${{ steps.version.outputs.version }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: toeverything/set-build-version@latest - uses: toeverything/set-build-version@latest
- id: version - id: version
run: echo ::set-output name=version::${{ env.BUILD_VERSION }} run: echo ::set-output name=version::${{ env.BUILD_VERSION }}
@@ -47,7 +47,7 @@ jobs:
needs: needs:
- set-build-version - set-build-version
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
- name: Setup @sentry/cli - name: Setup @sentry/cli
@@ -103,7 +103,7 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
SKIP_GENERATE_ASSETS: 1 SKIP_GENERATE_ASSETS: 1
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
timeout-minutes: 10 timeout-minutes: 10
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
@@ -174,7 +174,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Download Artifacts (macos-x64) - name: Download Artifacts (macos-x64)
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:

View File

@@ -17,7 +17,9 @@ jobs:
name: Check pull request title name: Check pull request title
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
- run: echo "${{ github.event.pull_request.title }}" | npx commitlint -g ./.commitlintrc.json with:
electron-install: false
- run: echo "${{ github.event.pull_request.title }}" | yarn dlx commitlint -g ./.commitlintrc.json

View File

@@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: development environment: development
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
ref: ${{ github.event.pull_request.merge_commit_sha }} ref: ${{ github.event.pull_request.merge_commit_sha }}
# This is required to fetch all commits for chromatic # This is required to fetch all commits for chromatic

View File

@@ -44,7 +44,7 @@ jobs:
outputs: outputs:
RELEASE_VERSION: ${{ steps.get-canary-version.outputs.RELEASE_VERSION }} RELEASE_VERSION: ${{ steps.get-canary-version.outputs.RELEASE_VERSION }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
- name: Setup @sentry/cli - name: Setup @sentry/cli
@@ -101,7 +101,7 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
SKIP_GENERATE_ASSETS: 1 SKIP_GENERATE_ASSETS: 1
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
timeout-minutes: 10 timeout-minutes: 10
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
@@ -119,9 +119,6 @@ jobs:
name: core name: core
path: apps/electron/resources/web-static path: apps/electron/resources/web-static
- name: Build Plugins
run: yarn run build:plugins
- name: Build Desktop Layers - name: Build Desktop Layers
run: yarn workspace @affine/electron build run: yarn workspace @affine/electron build
@@ -172,7 +169,7 @@ jobs:
env: env:
SKIP_GENERATE_ASSETS: 1 SKIP_GENERATE_ASSETS: 1
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
timeout-minutes: 10 timeout-minutes: 10
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
@@ -240,7 +237,7 @@ jobs:
outputs: outputs:
FILES_TO_BE_SIGNED: ${{ steps.get_files_to_be_signed.outputs.FILES_TO_BE_SIGNED }} FILES_TO_BE_SIGNED: ${{ steps.get_files_to_be_signed.outputs.FILES_TO_BE_SIGNED }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
timeout-minutes: 10 timeout-minutes: 10
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
@@ -318,7 +315,13 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: core
path: web-static
- name: Zip web-static
run: zip -r web-static.zip web-static
- name: Download Artifacts (macos-x64) - name: Download Artifacts (macos-x64)
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:

View File

@@ -17,7 +17,7 @@ jobs:
name: Try publishing npm@latest release name: Try publishing npm@latest release
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
- name: Try publishing to NPM - name: Try publishing to NPM
@@ -31,7 +31,7 @@ jobs:
environment: development environment: development
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
- name: Build Plugins - name: Build Plugins
@@ -50,7 +50,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: development environment: development
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
with: with:
@@ -72,7 +72,7 @@ jobs:
environment: development environment: development
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
- name: Setup Rust - name: Setup Rust
@@ -97,7 +97,7 @@ jobs:
- build-core - build-core
- build-storage - build-storage
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Download core artifact - name: Download core artifact
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:

View File

@@ -0,0 +1,15 @@
diff --git a/package.json b/package.json
index b64804360e64896c2eafde5e976dde0db480b4e3..63566d9e2725630827daefeeb211b950d329521b 100644
--- a/package.json
+++ b/package.json
@@ -31,6 +31,10 @@
"types": "./index.d.ts",
"default": "./index.js"
},
+ "./core": {
+ "types": "./core/index.d.ts",
+ "default": "./core/index.js"
+ },
"./adapters": {
"types": "./adapters.d.ts"
},

View File

@@ -266,7 +266,6 @@ export const createConfiguration: (
useDefineForClassFields: false, useDefineForClassFields: false,
}, },
experimental: { experimental: {
keepImportAssertions: true,
plugins: [ plugins: [
buildFlags.coverage && [ buildFlags.coverage && [
'swc-plugin-coverage-instrument', 'swc-plugin-coverage-instrument',

View File

@@ -44,14 +44,14 @@
"async-call-rpc": "^6.3.1", "async-call-rpc": "^6.3.1",
"css-spring": "^4.1.0", "css-spring": "^4.1.0",
"cssnano": "^6.0.1", "cssnano": "^6.0.1",
"graphql": "^16.8.0", "graphql": "^16.8.1",
"intl-segmenter-polyfill-rs": "^0.1.6", "intl-segmenter-polyfill-rs": "^0.1.6",
"jotai": "^2.4.1", "jotai": "^2.4.2",
"jotai-devtools": "^0.6.2", "jotai-devtools": "^0.6.2",
"lit": "^2.8.0", "lit": "^2.8.0",
"lottie-web": "^5.12.2", "lottie-web": "^5.12.2",
"mini-css-extract-plugin": "^2.7.6", "mini-css-extract-plugin": "^2.7.6",
"next-auth": "^4.22.1", "next-auth": "^4.23.1",
"next-themes": "^0.2.1", "next-themes": "^0.2.1",
"postcss-loader": "^7.3.3", "postcss-loader": "^7.3.3",
"react": "18.2.0", "react": "18.2.0",
@@ -63,17 +63,17 @@
"ses": "^0.18.8", "ses": "^0.18.8",
"swr": "2.2.0", "swr": "2.2.0",
"valtio": "^1.11.2", "valtio": "^1.11.2",
"y-protocols": "^1.0.5", "y-protocols": "^1.0.6",
"yjs": "^13.6.8", "yjs": "^13.6.8",
"zod": "^3.22.2" "zod": "^3.22.2"
}, },
"devDependencies": { "devDependencies": {
"@aws-sdk/client-s3": "3.400.0", "@aws-sdk/client-s3": "3.418.0",
"@perfsee/webpack": "^1.8.4", "@perfsee/webpack": "^1.8.4",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
"@sentry/webpack-plugin": "^2.7.0", "@sentry/webpack-plugin": "^2.7.1",
"@svgr/webpack": "^8.1.0", "@svgr/webpack": "^8.1.0",
"@swc/core": "^1.3.81", "@swc/core": "^1.3.87",
"@types/lodash-es": "^4.17.9", "@types/lodash-es": "^4.17.9",
"@types/webpack-env": "^1.18.1", "@types/webpack-env": "^1.18.1",
"copy-webpack-plugin": "^11.0.0", "copy-webpack-plugin": "^11.0.0",

View File

@@ -1,11 +1,12 @@
/* eslint-disable @typescript-eslint/no-var-requires */ /* eslint-disable @typescript-eslint/no-var-requires */
const path = require('node:path');
const { rm, symlink } = require('node:fs/promises');
const { const {
utils: { fromBuildIdentifier }, utils: { fromBuildIdentifier },
} = require('@electron-forge/core'); } = require('@electron-forge/core');
const path = require('node:path');
const { const {
arch, arch,
buildType, buildType,
@@ -25,7 +26,7 @@ const makers = [
icon: icnsPath, icon: icnsPath,
name: 'AFFiNE', name: 'AFFiNE',
'icon-size': 128, 'icon-size': 128,
background: path.resolve( background: path.join(
__dirname, __dirname,
'./resources/icons/dmg-background.png' './resources/icons/dmg-background.png'
), ),
@@ -34,7 +35,7 @@ const makers = [
x: 176, x: 176,
y: 192, y: 192,
type: 'file', type: 'file',
path: path.resolve( path: path.join(
__dirname, __dirname,
'out', 'out',
buildType, buildType,
@@ -45,7 +46,7 @@ const makers = [
{ x: 432, y: 192, type: 'link', path: '/Applications' }, { x: 432, y: 192, type: 'link', path: '/Applications' },
], ],
iconSize: 118, iconSize: 118,
file: path.resolve( file: path.join(
__dirname, __dirname,
'out', 'out',
buildType, buildType,
@@ -129,35 +130,14 @@ module.exports = {
packageJson.productName = productName; packageJson.productName = productName;
}, },
prePackage: async () => { prePackage: async () => {
const { rm, cp } = require('node:fs/promises'); await rm(path.join(__dirname, 'node_modules'), {
const { resolve } = require('node:path');
await rm(resolve(__dirname, './node_modules/@toeverything/infra'), {
recursive: true, recursive: true,
force: true, force: true,
}); });
await cp( await symlink(
resolve(__dirname, '../../packages/infra'), path.join(__dirname, '..', '..', 'node_modules'),
resolve(__dirname, './node_modules/@toeverything/infra'), path.join(__dirname, 'node_modules')
{
recursive: true,
force: true,
}
);
await rm(resolve(__dirname, './node_modules/@affine/sdk'), {
recursive: true,
force: true,
});
await cp(
resolve(__dirname, '../../packages/sdk'),
resolve(__dirname, './node_modules/@affine/sdk'),
{
recursive: true,
force: true,
}
); );
}, },
generateAssets: async (_, platform, arch) => { generateAssets: async (_, platform, arch) => {

View File

@@ -26,46 +26,53 @@
"main": "./dist/main.js", "main": "./dist/main.js",
"devDependencies": { "devDependencies": {
"@affine-test/kit": "workspace:*", "@affine-test/kit": "workspace:*",
"@affine/bookmark-plugin": "workspace:*",
"@affine/copilot-plugin": "workspace:*",
"@affine/env": "workspace:*", "@affine/env": "workspace:*",
"@affine/hello-world-plugin": "workspace:*",
"@affine/image-preview-plugin": "workspace:*",
"@affine/native": "workspace:*", "@affine/native": "workspace:*",
"@affine/outline-plugin": "workspace:*",
"@affine/sdk": "workspace:*", "@affine/sdk": "workspace:*",
"@affine/templates": "workspace:*",
"@affine/vue-hello-world-plugin": "workspace:*",
"@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/editor": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/editor": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/lit": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/lit": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"@electron-forge/cli": "^6.4.1", "@electron-forge/cli": "^6.4.2",
"@electron-forge/core": "^6.4.1", "@electron-forge/core": "^6.4.2",
"@electron-forge/core-utils": "^6.4.1", "@electron-forge/core-utils": "^6.4.2",
"@electron-forge/maker-deb": "^6.4.1", "@electron-forge/maker-deb": "^6.4.2",
"@electron-forge/maker-squirrel": "^6.4.1", "@electron-forge/maker-squirrel": "^6.4.2",
"@electron-forge/maker-zip": "^6.4.1", "@electron-forge/maker-zip": "^6.4.2",
"@electron-forge/shared-types": "^6.4.1", "@electron-forge/shared-types": "^6.4.2",
"@electron/remote": "2.0.11", "@electron/remote": "2.0.11",
"@reforged/maker-appimage": "^3.3.1", "@reforged/maker-appimage": "^3.3.1",
"@toeverything/infra": "workspace:*", "@toeverything/infra": "workspace:*",
"@types/uuid": "^9.0.3", "@types/uuid": "^9.0.4",
"cross-env": "7.0.3", "cross-env": "7.0.3",
"electron": "^26.2.1", "electron": "^26.2.2",
"electron-log": "^5.0.0-beta.28", "electron-log": "^5.0.0-beta.29",
"electron-squirrel-startup": "1.0.0", "electron-squirrel-startup": "1.0.0",
"electron-window-state": "^5.0.3", "electron-window-state": "^5.0.3",
"esbuild": "^0.19.2", "esbuild": "^0.19.3",
"fs-extra": "^11.1.1", "fs-extra": "^11.1.1",
"glob": "^10.3.4", "glob": "^10.3.5",
"jotai": "^2.4.1", "jotai": "^2.4.2",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"rxjs": "^7.8.1", "rxjs": "^7.8.1",
"tinykeys": "^2.1.0", "tinykeys": "^2.1.0",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"undici": "^5.23.0", "undici": "^5.25.2",
"uuid": "^9.0.0", "uuid": "^9.0.1",
"vitest": "0.33.0", "vitest": "0.34.5",
"which": "^4.0.0", "which": "^4.0.0",
"zx": "^7.2.3" "zx": "^7.2.3"
}, },
"dependencies": { "dependencies": {
"async-call-rpc": "^6.3.1", "async-call-rpc": "^6.3.1",
"electron-updater": "^6.1.4", "electron-updater": "^6.1.5",
"link-preview-js": "^3.0.5", "link-preview-js": "^3.0.5",
"nanoid": "^4.0.2", "nanoid": "^4.0.2",
"yjs": "^13.6.8" "yjs": "^13.6.8"
@@ -81,9 +88,6 @@
] ]
}, },
"stableVersion": "0.5.3", "stableVersion": "0.5.3",
"installConfig": {
"hoistingLimits": "workspaces"
},
"peerDependencies": { "peerDependencies": {
"ts-node": "*" "ts-node": "*"
} }

View File

@@ -46,13 +46,21 @@ export async function getWorkspaceMeta(
try { try {
const basePath = await getWorkspaceBasePath(workspaceId); const basePath = await getWorkspaceBasePath(workspaceId);
const metaPath = await getWorkspaceMetaPath(workspaceId); const metaPath = await getWorkspaceMetaPath(workspaceId);
if (!(await fs.exists(metaPath))) { if (
!(await fs
.access(metaPath)
.then(() => true)
.catch(() => false))
) {
// since not meta is found, we will migrate symlinked db file if needed // since not meta is found, we will migrate symlinked db file if needed
await fs.ensureDir(basePath); await fs.ensureDir(basePath);
const dbPath = await getWorkspaceDBPath(workspaceId); const dbPath = await getWorkspaceDBPath(workspaceId);
// todo: remove this after migration (in stable version) // todo: remove this after migration (in stable version)
const realDBPath = (await fs.exists(dbPath)) const realDBPath = (await fs
.access(dbPath)
.then(() => true)
.catch(() => false))
? await fs.realpath(dbPath) ? await fs.realpath(dbPath)
: dbPath; : dbPath;
const isLink = realDBPath !== dbPath; const isLink = realDBPath !== dbPath;

View File

@@ -17,76 +17,76 @@
}, },
"dependencies": { "dependencies": {
"@apollo/server": "^4.9.3", "@apollo/server": "^4.9.3",
"@auth/prisma-adapter": "^1.0.1", "@auth/prisma-adapter": "^1.0.2",
"@aws-sdk/client-s3": "^3.400.0", "@aws-sdk/client-s3": "^3.418.0",
"@google-cloud/opentelemetry-cloud-monitoring-exporter": "^0.17.0", "@google-cloud/opentelemetry-cloud-monitoring-exporter": "^0.17.0",
"@google-cloud/opentelemetry-cloud-trace-exporter": "^2.1.0", "@google-cloud/opentelemetry-cloud-trace-exporter": "^2.1.0",
"@keyv/redis": "^2.7.0", "@keyv/redis": "^2.7.1",
"@nestjs/apollo": "^12.0.7", "@nestjs/apollo": "^12.0.9",
"@nestjs/common": "^10.2.4", "@nestjs/common": "^10.2.6",
"@nestjs/core": "^10.2.4", "@nestjs/core": "^10.2.6",
"@nestjs/graphql": "^12.0.8", "@nestjs/graphql": "^12.0.9",
"@nestjs/platform-express": "^10.2.4", "@nestjs/platform-express": "^10.2.6",
"@nestjs/platform-socket.io": "^10.2.4", "@nestjs/platform-socket.io": "^10.2.6",
"@nestjs/throttler": "^4.2.1", "@nestjs/throttler": "^5.0.0",
"@nestjs/websockets": "^10.2.4", "@nestjs/websockets": "^10.2.6",
"@node-rs/argon2": "^1.5.2", "@node-rs/argon2": "^1.5.2",
"@node-rs/crc32": "^1.7.2", "@node-rs/crc32": "^1.7.2",
"@node-rs/jsonwebtoken": "^0.2.3", "@node-rs/jsonwebtoken": "^0.2.3",
"@opentelemetry/api": "^1.4.1", "@opentelemetry/api": "^1.6.0",
"@opentelemetry/instrumentation": "^0.41.2", "@opentelemetry/instrumentation": "^0.43.0",
"@opentelemetry/instrumentation-graphql": "^0.35.1", "@opentelemetry/instrumentation-graphql": "^0.35.1",
"@opentelemetry/instrumentation-http": "^0.41.2", "@opentelemetry/instrumentation-http": "^0.43.0",
"@opentelemetry/instrumentation-ioredis": "^0.35.1", "@opentelemetry/instrumentation-ioredis": "^0.35.1",
"@opentelemetry/instrumentation-nestjs-core": "^0.33.1", "@opentelemetry/instrumentation-nestjs-core": "^0.33.1",
"@opentelemetry/instrumentation-socket.io": "^0.34.1", "@opentelemetry/instrumentation-socket.io": "^0.34.1",
"@opentelemetry/sdk-metrics": "^1.15.2", "@opentelemetry/sdk-metrics": "^1.17.0",
"@opentelemetry/sdk-node": "^0.41.2", "@opentelemetry/sdk-node": "^0.43.0",
"@opentelemetry/sdk-trace-node": "^1.15.2", "@opentelemetry/sdk-trace-node": "^1.17.0",
"@prisma/client": "^5.2.0", "@prisma/client": "^5.3.1",
"@prisma/instrumentation": "^5.2.0", "@prisma/instrumentation": "^5.3.1",
"@socket.io/redis-adapter": "^8.2.1", "@socket.io/redis-adapter": "^8.2.1",
"cookie-parser": "^1.4.6", "cookie-parser": "^1.4.6",
"dotenv": "^16.3.1", "dotenv": "^16.3.1",
"express": "^4.18.2", "express": "^4.18.2",
"file-type": "^18.5.0", "file-type": "^18.5.0",
"get-stream": "^8.0.1", "get-stream": "^8.0.1",
"graphql": "^16.8.0", "graphql": "^16.8.1",
"graphql-type-json": "^0.3.2", "graphql-type-json": "^0.3.2",
"graphql-upload": "^16.0.2", "graphql-upload": "^16.0.2",
"ioredis": "^5.3.2", "ioredis": "^5.3.2",
"keyv": "^4.5.3", "keyv": "^4.5.3",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"nanoid": "^4.0.2", "nanoid": "^4.0.2",
"nestjs-throttler-storage-redis": "^0.4.0", "nestjs-throttler-storage-redis": "^0.4.1",
"next-auth": "4.22.5", "next-auth": "4.23.1",
"nodemailer": "^6.9.4", "nodemailer": "^6.9.5",
"on-headers": "^1.0.2", "on-headers": "^1.0.2",
"parse-duration": "^1.1.0", "parse-duration": "^1.1.0",
"pretty-time": "^1.1.0", "pretty-time": "^1.1.0",
"prisma": "^5.2.0", "prisma": "^5.3.1",
"prom-client": "^14.2.0", "prom-client": "^14.2.0",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1", "rxjs": "^7.8.1",
"semver": "^7.5.4", "semver": "^7.5.4",
"socket.io": "^4.7.2", "socket.io": "^4.7.2",
"ws": "^8.13.0", "ws": "^8.14.2",
"yjs": "^13.6.8" "yjs": "^13.6.8"
}, },
"devDependencies": { "devDependencies": {
"@affine-test/kit": "workspace:*", "@affine-test/kit": "workspace:*",
"@affine/storage": "workspace:*", "@affine/storage": "workspace:*",
"@napi-rs/image": "^1.6.1", "@napi-rs/image": "^1.6.1",
"@nestjs/testing": "^10.2.4", "@nestjs/testing": "^10.2.6",
"@types/cookie-parser": "^1.4.4", "@types/cookie-parser": "^1.4.4",
"@types/engine.io": "^3.1.7", "@types/engine.io": "^3.1.7",
"@types/express": "^4.17.17", "@types/express": "^4.17.17",
"@types/graphql-upload": "^16.0.1", "@types/graphql-upload": "^16.0.2",
"@types/keyv": "^4.2.0", "@types/keyv": "^4.2.0",
"@types/lodash-es": "^4.17.9", "@types/lodash-es": "^4.17.9",
"@types/node": "^18.17.12", "@types/node": "^18.17.18",
"@types/nodemailer": "^6.4.9", "@types/nodemailer": "^6.4.10",
"@types/on-headers": "^1.0.0", "@types/on-headers": "^1.0.1",
"@types/pretty-time": "^1.1.2", "@types/pretty-time": "^1.1.2",
"@types/sinon": "^10.0.16", "@types/sinon": "^10.0.16",
"@types/supertest": "^2.0.12", "@types/supertest": "^2.0.12",
@@ -103,7 +103,9 @@
"extensions": { "extensions": {
"ts": "module" "ts": "module"
}, },
"workerThreads": false,
"nodeArguments": [ "nodeArguments": [
"--trace-sigint",
"--loader", "--loader",
"ts-node/esm/transpile-only.mjs", "ts-node/esm/transpile-only.mjs",
"--es-module-specifier-resolution", "--es-module-specifier-resolution",

View File

@@ -81,7 +81,6 @@ export const NextAuthOptionsProvider: FactoryProvider<NextAuthOptions> = {
sendVerificationRequest(config, logger, mailer, session, params), sendVerificationRequest(config, logger, mailer, session, params),
}), }),
], ],
// @ts-expect-error Third part library type mismatch
adapter: prismaAdapter, adapter: prismaAdapter,
debug: !config.node.prod, debug: !config.node.prod,
session: { session: {

View File

@@ -50,7 +50,12 @@ export class NextAuthController {
} }
@UseGuards(AuthThrottlerGuard) @UseGuards(AuthThrottlerGuard)
@Throttle(60, 60) @Throttle({
default: {
limit: 60,
ttl: 60,
},
})
@All('*') @All('*')
async auth( async auth(
@Req() req: Request, @Req() req: Request,

View File

@@ -50,7 +50,12 @@ export class AuthResolver {
private readonly session: SessionService private readonly session: SessionService
) {} ) {}
@Throttle(20, 60) @Throttle({
default: {
limit: 20,
ttl: 60,
},
})
@ResolveField(() => TokenType) @ResolveField(() => TokenType)
async token( async token(
@Context() ctx: { req: Request }, @Context() ctx: { req: Request },
@@ -82,7 +87,12 @@ export class AuthResolver {
}; };
} }
@Throttle(10, 60) @Throttle({
default: {
limit: 10,
ttl: 60,
},
})
@Mutation(() => UserType) @Mutation(() => UserType)
async signUp( async signUp(
@Context() ctx: { req: Request }, @Context() ctx: { req: Request },
@@ -95,7 +105,12 @@ export class AuthResolver {
return user; return user;
} }
@Throttle(10, 60) @Throttle({
default: {
limit: 10,
ttl: 60,
},
})
@Mutation(() => UserType) @Mutation(() => UserType)
async signIn( async signIn(
@Context() ctx: { req: Request }, @Context() ctx: { req: Request },
@@ -107,7 +122,12 @@ export class AuthResolver {
return user; return user;
} }
@Throttle(5, 60) @Throttle({
default: {
limit: 5,
ttl: 60,
},
})
@Mutation(() => UserType) @Mutation(() => UserType)
@Auth() @Auth()
async changePassword( async changePassword(
@@ -126,7 +146,12 @@ export class AuthResolver {
return user; return user;
} }
@Throttle(5, 60) @Throttle({
default: {
limit: 5,
ttl: 60,
},
})
@Mutation(() => UserType) @Mutation(() => UserType)
@Auth() @Auth()
async changeEmail( async changeEmail(
@@ -147,7 +172,12 @@ export class AuthResolver {
return user; return user;
} }
@Throttle(5, 60) @Throttle({
default: {
limit: 5,
ttl: 60,
},
})
@Mutation(() => Boolean) @Mutation(() => Boolean)
@Auth() @Auth()
async sendChangePasswordEmail( async sendChangePasswordEmail(
@@ -165,7 +195,12 @@ export class AuthResolver {
return !res.rejected.length; return !res.rejected.length;
} }
@Throttle(5, 60) @Throttle({
default: {
limit: 5,
ttl: 60,
},
})
@Mutation(() => Boolean) @Mutation(() => Boolean)
@Auth() @Auth()
async sendSetPasswordEmail( async sendSetPasswordEmail(
@@ -190,7 +225,12 @@ export class AuthResolver {
// 4. user open confirm email page from new email // 4. user open confirm email page from new email
// 5. user click confirm button // 5. user click confirm button
// 6. send notification email // 6. send notification email
@Throttle(5, 60) @Throttle({
default: {
limit: 5,
ttl: 60,
},
})
@Mutation(() => Boolean) @Mutation(() => Boolean)
@Auth() @Auth()
async sendChangeEmail( async sendChangeEmail(
@@ -208,7 +248,12 @@ export class AuthResolver {
return !res.rejected.length; return !res.rejected.length;
} }
@Throttle(5, 60) @Throttle({
default: {
limit: 5,
ttl: 60,
},
})
@Mutation(() => Boolean) @Mutation(() => Boolean)
@Auth() @Auth()
async sendVerifyChangeEmail( async sendVerifyChangeEmail(

View File

@@ -91,7 +91,12 @@ export class UserResolver {
private readonly users: UsersService private readonly users: UsersService
) {} ) {}
@Throttle(10, 60) @Throttle({
default: {
limit: 10,
ttl: 60,
},
})
@Query(() => UserType, { @Query(() => UserType, {
name: 'currentUser', name: 'currentUser',
description: 'Get current user', description: 'Get current user',
@@ -112,7 +117,12 @@ export class UserResolver {
}; };
} }
@Throttle(10, 60) @Throttle({
default: {
limit: 10,
ttl: 60,
},
})
@Query(() => UserType, { @Query(() => UserType, {
name: 'user', name: 'user',
description: 'Get user by email', description: 'Get user by email',
@@ -140,7 +150,12 @@ export class UserResolver {
return user; return user;
} }
@Throttle(10, 60) @Throttle({
default: {
limit: 10,
ttl: 60,
},
})
@Mutation(() => UserType, { @Mutation(() => UserType, {
name: 'uploadAvatar', name: 'uploadAvatar',
description: 'Upload user avatar', description: 'Upload user avatar',
@@ -160,7 +175,12 @@ export class UserResolver {
}); });
} }
@Throttle(10, 60) @Throttle({
default: {
limit: 10,
ttl: 60,
},
})
@Mutation(() => RemoveAvatar, { @Mutation(() => RemoveAvatar, {
name: 'removeAvatar', name: 'removeAvatar',
description: 'Remove user avatar', description: 'Remove user avatar',
@@ -176,14 +196,24 @@ export class UserResolver {
return { success: true }; return { success: true };
} }
@Throttle(10, 60) @Throttle({
default: {
limit: 10,
ttl: 60,
},
})
@Mutation(() => DeleteAccount) @Mutation(() => DeleteAccount)
async deleteAccount(@CurrentUser() user: UserType): Promise<DeleteAccount> { async deleteAccount(@CurrentUser() user: UserType): Promise<DeleteAccount> {
await this.users.deleteUser(user.id); await this.users.deleteUser(user.id);
return { success: true }; return { success: true };
} }
@Throttle(10, 60) @Throttle({
default: {
limit: 10,
ttl: 60,
},
})
@Mutation(() => AddToNewFeaturesWaitingList) @Mutation(() => AddToNewFeaturesWaitingList)
async addToNewFeaturesWaitingList( async addToNewFeaturesWaitingList(
@CurrentUser() user: UserType, @CurrentUser() user: UserType,

View File

@@ -282,7 +282,12 @@ export class WorkspaceResolver {
}); });
} }
@Throttle(10, 30) @Throttle({
default: {
limit: 10,
ttl: 30,
},
})
@Public() @Public()
@Query(() => WorkspaceType, { @Query(() => WorkspaceType, {
description: 'Get public workspace by id', description: 'Get public workspace by id',
@@ -515,7 +520,12 @@ export class WorkspaceResolver {
} }
} }
@Throttle(10, 30) @Throttle({
default: {
limit: 10,
ttl: 30,
},
})
@Public() @Public()
@Query(() => InvitationType, { @Query(() => InvitationType, {
description: 'Update workspace', description: 'Update workspace',

View File

@@ -20,8 +20,12 @@ import { getRequestResponseFromContext } from './utils/nestjs';
inject: [Config], inject: [Config],
useFactory: (config: Config): ThrottlerModuleOptions => { useFactory: (config: Config): ThrottlerModuleOptions => {
const options: ThrottlerModuleOptions = { const options: ThrottlerModuleOptions = {
ttl: config.rateLimiter.ttl, throttlers: [
limit: config.rateLimiter.limit, {
ttl: config.rateLimiter.ttl,
limit: config.rateLimiter.limit,
},
],
skipIf: () => { skipIf: () => {
return !config.node.prod || config.affine.canary; return !config.node.prod || config.affine.canary;
}, },
@@ -49,8 +53,10 @@ export class CloudThrottlerGuard extends ThrottlerGuard {
return getRequestResponseFromContext(context) as any; return getRequestResponseFromContext(context) as any;
} }
protected override getTracker(req: Record<string, any>): string { protected override getTracker(req: Record<string, any>): Promise<string> {
return req?.get('CF-Connecting-IP') ?? req?.get('CF-ray') ?? req?.ip; return Promise.resolve(
req?.get('CF-Connecting-IP') ?? req?.get('CF-ray') ?? req?.ip
);
} }
} }
@@ -65,10 +71,16 @@ export class AuthThrottlerGuard extends CloudThrottlerGuard {
if (req?.url === '/api/auth/session') { if (req?.url === '/api/auth/session') {
// relax throttle for session auto renew // relax throttle for session auto renew
return super.handleRequest(context, limit * 20, ttl); return super.handleRequest(context, limit * 20, ttl, {
ttl: ttl * 20,
limit: limit * 20,
});
} }
return super.handleRequest(context, limit, ttl); return super.handleRequest(context, limit, ttl, {
ttl,
limit,
});
} }
} }

View File

@@ -5,9 +5,9 @@ import { Transformer } from '@napi-rs/image';
import type { INestApplication } from '@nestjs/common'; import type { INestApplication } from '@nestjs/common';
import { Test } from '@nestjs/testing'; import { Test } from '@nestjs/testing';
import { hashSync } from '@node-rs/argon2'; import { hashSync } from '@node-rs/argon2';
import { User } from '@prisma/client'; import { type User } from '@prisma/client';
import ava, { TestFn } from 'ava'; import ava, { type TestFn } from 'ava';
import { Express } from 'express'; import type { Express } from 'express';
import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs'; import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs';
import request from 'supertest'; import request from 'supertest';

View File

@@ -5,7 +5,7 @@ import {
import type { INestApplication } from '@nestjs/common'; import type { INestApplication } from '@nestjs/common';
import { Test } from '@nestjs/testing'; import { Test } from '@nestjs/testing';
import { PrismaClient } from '@prisma/client'; import { PrismaClient } from '@prisma/client';
import ava, { TestFn } from 'ava'; import ava, { type TestFn } from 'ava';
import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs'; import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs';
import { AppModule } from '../src/app'; import { AppModule } from '../src/app';

View File

@@ -1,6 +1,6 @@
import { mock } from 'node:test'; import { mock } from 'node:test';
import { INestApplication } from '@nestjs/common'; import type { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing'; import { Test, TestingModule } from '@nestjs/testing';
import test from 'ava'; import test from 'ava';
import { register } from 'prom-client'; import { register } from 'prom-client';

View File

@@ -1,4 +1,4 @@
import { Controller, Get, INestApplication } from '@nestjs/common'; import { Controller, Get, type INestApplication } from '@nestjs/common';
import { Test } from '@nestjs/testing'; import { Test } from '@nestjs/testing';
import test from 'ava'; import test from 'ava';
import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs'; import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs';

View File

@@ -8,7 +8,7 @@ import {
} from '@affine-test/kit/utils/cloud'; } from '@affine-test/kit/utils/cloud';
import { Test, TestingModule } from '@nestjs/testing'; import { Test, TestingModule } from '@nestjs/testing';
import { PrismaClient } from '@prisma/client'; import { PrismaClient } from '@prisma/client';
import ava, { TestFn } from 'ava'; import ava, { type TestFn } from 'ava';
import { ConfigModule } from '../src/config'; import { ConfigModule } from '../src/config';
import { GqlModule } from '../src/graphql.module'; import { GqlModule } from '../src/graphql.module';

View File

@@ -3,8 +3,8 @@ import { randomUUID } from 'node:crypto';
import type { INestApplication } from '@nestjs/common'; import type { INestApplication } from '@nestjs/common';
import { Test } from '@nestjs/testing'; import { Test } from '@nestjs/testing';
import { hashSync } from '@node-rs/argon2'; import { hashSync } from '@node-rs/argon2';
import { User } from '@prisma/client'; import { type User } from '@prisma/client';
import ava, { TestFn } from 'ava'; import ava, { type TestFn } from 'ava';
import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs'; import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs';
import { AppModule } from '../src/app'; import { AppModule } from '../src/app';

View File

@@ -1,7 +1,7 @@
/// <reference types="../src/global.d.ts" /> /// <reference types="../src/global.d.ts" />
import { Test, TestingModule } from '@nestjs/testing'; import { Test, TestingModule } from '@nestjs/testing';
import ava, { TestFn } from 'ava'; import ava, { type TestFn } from 'ava';
import { ConfigModule } from '../src/config'; import { ConfigModule } from '../src/config';
import { SessionModule, SessionService } from '../src/session'; import { SessionModule, SessionService } from '../src/session';

View File

@@ -1,5 +1,5 @@
{ {
"extends": "../tsconfig.json", "extends": "../../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"composite": true, "composite": true,
"target": "ESNext", "target": "ESNext",
@@ -7,6 +7,7 @@
"experimentalDecorators": true, "experimentalDecorators": true,
"rootDir": ".", "rootDir": ".",
"outDir": "../lib/tests", "outDir": "../lib/tests",
"verbatimModuleSyntax": false,
"tsBuildInfoFile": "../lib/tests/.tsbuildinfo" "tsBuildInfoFile": "../lib/tests/.tsbuildinfo"
}, },
"references": [ "references": [

View File

@@ -2,7 +2,7 @@ import { randomUUID } from 'node:crypto';
import type { INestApplication } from '@nestjs/common'; import type { INestApplication } from '@nestjs/common';
import { hashSync } from '@node-rs/argon2'; import { hashSync } from '@node-rs/argon2';
import { PrismaClient, User } from '@prisma/client'; import { PrismaClient, type User } from '@prisma/client';
import request from 'supertest'; import request from 'supertest';
import type { TokenType } from '../src/modules/auth'; import type { TokenType } from '../src/modules/auth';

View File

@@ -5,7 +5,7 @@ import {
import type { INestApplication } from '@nestjs/common'; import type { INestApplication } from '@nestjs/common';
import { Test } from '@nestjs/testing'; import { Test } from '@nestjs/testing';
import { PrismaClient } from '@prisma/client'; import { PrismaClient } from '@prisma/client';
import ava, { TestFn } from 'ava'; import ava, { type TestFn } from 'ava';
import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs'; import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs';
import { AppModule } from '../src/app'; import { AppModule } from '../src/app';

View File

@@ -1,6 +1,6 @@
import type { INestApplication } from '@nestjs/common'; import type { INestApplication } from '@nestjs/common';
import { Test } from '@nestjs/testing'; import { Test } from '@nestjs/testing';
import ava, { TestFn } from 'ava'; import ava, { type TestFn } from 'ava';
import { stub } from 'sinon'; import { stub } from 'sinon';
import { AppModule } from '../src/app'; import { AppModule } from '../src/app';

View File

@@ -1,7 +1,7 @@
import type { INestApplication } from '@nestjs/common'; import type { INestApplication } from '@nestjs/common';
import { Test } from '@nestjs/testing'; import { Test } from '@nestjs/testing';
import { PrismaClient } from '@prisma/client'; import { PrismaClient } from '@prisma/client';
import ava, { TestFn } from 'ava'; import ava, { type TestFn } from 'ava';
import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs'; import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs';
import request from 'supertest'; import request from 'supertest';

View File

@@ -13,7 +13,6 @@
"types": ["node"], "types": ["node"],
"outDir": "dist", "outDir": "dist",
"noEmit": false, "noEmit": false,
"tsBuildInfoFile": "./dist/.tsbuildinfo",
"verbatimModuleSyntax": false, "verbatimModuleSyntax": false,
"rootDir": "./src" "rootDir": "./src"
}, },

View File

@@ -9,21 +9,21 @@
"dependencies": { "dependencies": {
"@affine/component": "workspace:*", "@affine/component": "workspace:*",
"@affine/i18n": "workspace:*", "@affine/i18n": "workspace:*",
"@storybook/addon-actions": "^7.4.0", "@storybook/addon-actions": "^7.4.4",
"@storybook/addon-essentials": "^7.4.0", "@storybook/addon-essentials": "^7.4.4",
"@storybook/addon-interactions": "^7.4.0", "@storybook/addon-interactions": "^7.4.4",
"@storybook/addon-links": "^7.4.0", "@storybook/addon-links": "^7.4.4",
"@storybook/addon-storysource": "^7.4.0", "@storybook/addon-storysource": "^7.4.4",
"@storybook/blocks": "^7.4.0", "@storybook/blocks": "^7.4.4",
"@storybook/builder-vite": "^7.4.0", "@storybook/builder-vite": "^7.4.4",
"@storybook/jest": "^0.2.2", "@storybook/jest": "^0.2.2",
"@storybook/react": "^7.4.0", "@storybook/react": "^7.4.4",
"@storybook/react-vite": "^7.4.0", "@storybook/react-vite": "^7.4.4",
"@storybook/test-runner": "^0.13.0", "@storybook/test-runner": "^0.13.0",
"@storybook/testing-library": "^0.2.0", "@storybook/testing-library": "^0.2.1",
"@vitejs/plugin-react": "^4.0.4", "@vitejs/plugin-react": "^4.0.4",
"concurrently": "^8.2.1", "concurrently": "^8.2.1",
"jest-mock": "^29.6.3", "jest-mock": "^29.7.0",
"serve": "^14.2.1", "serve": "^14.2.1",
"ses": "^0.18.8", "ses": "^0.18.8",
"storybook": "^7.4.0", "storybook": "^7.4.0",
@@ -39,7 +39,7 @@
"@blocksuite/lit": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/lit": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"@tomfreudenberg/next-auth-mock": "^0.5.6", "@tomfreudenberg/next-auth-mock": "^0.5.6",
"chromatic": "^6.24.1", "chromatic": "^7.2.0",
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"storybook-addon-react-router-v6": "^2.0.7" "storybook-addon-react-router-v6": "^2.0.7"

View File

@@ -66,28 +66,28 @@
"@affine/plugin-cli": "workspace:*", "@affine/plugin-cli": "workspace:*",
"@commitlint/cli": "^17.7.1", "@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0", "@commitlint/config-conventional": "^17.7.0",
"@faker-js/faker": "^8.0.2", "@faker-js/faker": "^8.1.0",
"@istanbuljs/schema": "^0.1.3", "@istanbuljs/schema": "^0.1.3",
"@magic-works/i18n-codegen": "^0.5.0", "@magic-works/i18n-codegen": "^0.5.0",
"@nx/vite": "16.8.1", "@nx/vite": "16.9.0",
"@perfsee/sdk": "^1.9.0", "@perfsee/sdk": "^1.9.0",
"@playwright/test": "^1.37.1", "@playwright/test": "^1.38.1",
"@taplo/cli": "^0.5.2", "@taplo/cli": "^0.5.2",
"@testing-library/react": "^14.0.0", "@testing-library/react": "^14.0.0",
"@toeverything/infra": "workspace:*", "@toeverything/infra": "workspace:*",
"@types/affine__env": "workspace:*", "@types/affine__env": "workspace:*",
"@types/eslint": "^8.44.2", "@types/eslint": "^8.44.2",
"@types/node": "^18.17.12", "@types/node": "^18.17.18",
"@typescript-eslint/eslint-plugin": "^6.5.0", "@typescript-eslint/eslint-plugin": "^6.7.2",
"@typescript-eslint/parser": "^6.5.0", "@typescript-eslint/parser": "^6.7.2",
"@vanilla-extract/vite-plugin": "^3.9.0", "@vanilla-extract/vite-plugin": "^3.9.0",
"@vanilla-extract/webpack-plugin": "^2.3.0", "@vanilla-extract/webpack-plugin": "^2.3.1",
"@vitejs/plugin-react-swc": "^3.3.2", "@vitejs/plugin-react-swc": "^3.3.2",
"@vitest/coverage-istanbul": "0.33.0", "@vitest/coverage-istanbul": "0.34.5",
"@vitest/ui": "0.33.0", "@vitest/ui": "0.34.5",
"eslint": "^8.48.0", "eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0", "eslint-config-prettier": "^9.0.0",
"eslint-plugin-i": "^2.28.0", "eslint-plugin-i": "^2.28.1",
"eslint-plugin-prettier": "^5.0.0", "eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.2", "eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks": "^4.6.0",
@@ -101,21 +101,22 @@
"husky": "^8.0.3", "husky": "^8.0.3",
"lint-staged": "^14.0.1", "lint-staged": "^14.0.1",
"madge": "^6.1.0", "madge": "^6.1.0",
"msw": "^1.2.5", "msw": "^1.3.1",
"nanoid": "^4.0.2", "nanoid": "^4.0.2",
"nx": "16.8.1", "nx": "^16.9.0",
"nx-cloud": "latest", "nx-cloud": "^16.4.0",
"nyc": "^15.1.0", "nyc": "^15.1.0",
"prettier": "^3.0.3", "prettier": "^3.0.3",
"semver": "^7.5.4", "semver": "^7.5.4",
"serve": "^14.2.1", "serve": "^14.2.1",
"string-width": "^5.1.2",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"vite": "^4.4.9", "vite": "^4.4.9",
"vite-plugin-istanbul": "^5.0.0", "vite-plugin-istanbul": "^5.0.0",
"vite-plugin-static-copy": "^0.17.0", "vite-plugin-static-copy": "^0.17.0",
"vite-tsconfig-paths": "^4.2.1", "vite-tsconfig-paths": "^4.2.1",
"vitest": "0.33.0", "vitest": "0.34.5",
"vitest-fetch-mock": "^0.2.2", "vitest-fetch-mock": "^0.2.2",
"vitest-mock-extended": "^1.2.1" "vitest-mock-extended": "^1.2.1"
}, },
@@ -175,6 +176,8 @@
"typed-array-length": "npm:@nolyfill/typed-array-length@latest", "typed-array-length": "npm:@nolyfill/typed-array-length@latest",
"unbox-primitive": "npm:@nolyfill/unbox-primitive@latest", "unbox-primitive": "npm:@nolyfill/unbox-primitive@latest",
"which-boxed-primitive": "npm:@nolyfill/which-boxed-primitive@latest", "which-boxed-primitive": "npm:@nolyfill/which-boxed-primitive@latest",
"which-typed-array": "npm:@nolyfill/which-typed-array@latest" "which-typed-array": "npm:@nolyfill/which-typed-array@latest",
"next-auth@^4.23.1": "patch:next-auth@npm%3A4.23.1#./.yarn/patches/next-auth-npm-4.23.1-6ed6a0f727.patch",
"next-auth@4.23.1": "patch:next-auth@npm%3A4.23.1#./.yarn/patches/next-auth-npm-4.23.1-6ed6a0f727.patch"
} }
} }

View File

@@ -36,17 +36,18 @@
"@radix-ui/react-scroll-area": "^1.0.4", "@radix-ui/react-scroll-area": "^1.0.4",
"@radix-ui/react-toast": "^1.1.4", "@radix-ui/react-toast": "^1.1.4",
"@toeverything/hooks": "workspace:*", "@toeverything/hooks": "workspace:*",
"@toeverything/infra": "workspace:*",
"@toeverything/theme": "^0.7.18", "@toeverything/theme": "^0.7.18",
"@vanilla-extract/dynamic": "^2.0.3", "@vanilla-extract/dynamic": "^2.0.3",
"check-password-strength": "^2.0.7", "check-password-strength": "^2.0.7",
"clsx": "^2.0.0", "clsx": "^2.0.0",
"dayjs": "^1.11.9", "dayjs": "^1.11.10",
"jotai": "^2.4.1", "jotai": "^2.4.2",
"lit": "^2.8.0", "lit": "^2.8.0",
"lottie-react": "^2.4.0", "lottie-react": "^2.4.0",
"lottie-web": "^5.12.2", "lottie-web": "^5.12.2",
"react": "18.2.0", "react": "18.2.0",
"react-datepicker": "^4.16.0", "react-datepicker": "^4.18.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-error-boundary": "^4.0.11", "react-error-boundary": "^4.0.11",
"react-is": "^18.2.0", "react-is": "^18.2.0",
@@ -60,7 +61,7 @@
"@blocksuite/icons": "^2.1.33", "@blocksuite/icons": "^2.1.33",
"@blocksuite/lit": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/lit": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"@types/react": "^18.2.21", "@types/react": "^18.2.22",
"@types/react-datepicker": "^4.15.0", "@types/react-datepicker": "^4.15.0",
"@types/react-dnd": "^3.0.2", "@types/react-dnd": "^3.0.2",
"@types/react-dom": "^18.2.7", "@types/react-dom": "^18.2.7",

View File

@@ -6,7 +6,7 @@
"debug": "^4.3.4" "debug": "^4.3.4"
}, },
"devDependencies": { "devDependencies": {
"@types/debug": "^4.1.8" "@types/debug": "^4.1.9"
}, },
"version": "0.9.0-canary.13" "version": "0.9.0-canary.13"
} }

View File

@@ -23,7 +23,10 @@
}, },
"dependencies": { "dependencies": {
"@affine/env": "workspace:*", "@affine/env": "workspace:*",
"graphql": "^16.8.0", "graphql": "^16.8.1",
"nanoid": "^4.0.2" "nanoid": "^4.0.2"
},
"installConfig": {
"hoistingLimits": "workspaces"
} }
} }

View File

@@ -27,11 +27,11 @@
"url": "git+https://github.com/toeverything/AFFiNE.git" "url": "git+https://github.com/toeverything/AFFiNE.git"
}, },
"dependencies": { "dependencies": {
"i18next": "^23.4.6", "i18next": "^23.5.1",
"react-i18next": "^13.1.2" "react-i18next": "^13.1.2"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^18.17.12", "@types/node": "^18.17.18",
"@types/prettier": "^3.0.0", "@types/prettier": "^3.0.0",
"prettier": "^3.0.3", "prettier": "^3.0.3",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",

View File

@@ -58,7 +58,7 @@
"@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"jotai": "^2.4.1", "jotai": "^2.4.2",
"tinykeys": "^2.1.0", "tinykeys": "^2.1.0",
"zod": "^3.22.2" "zod": "^3.22.2"
}, },
@@ -69,7 +69,7 @@
"electron": "link:../../apps/electron/node_modules/electron", "electron": "link:../../apps/electron/node_modules/electron",
"react": "^18.2.0", "react": "^18.2.0",
"vite": "^4.4.9", "vite": "^4.4.9",
"vite-plugin-dts": "3.5.3", "vite-plugin-dts": "3.5.4",
"yjs": "^13.6.8" "yjs": "^13.6.8"
}, },
"peerDependencies": { "peerDependencies": {

View File

@@ -19,13 +19,15 @@
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@napi-rs/cli": "^2.16.2", "@napi-rs/cli": "^2.16.2",
"@types/node": "^18.17.12", "@types/node": "^18.17.18",
"@types/uuid": "^9.0.3", "@types/uuid": "^9.0.4",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"nx": "^16.9.0",
"nx-cloud": "^16.4.0",
"rxjs": "^7.8.1", "rxjs": "^7.8.1",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"uuid": "^9.0.0" "uuid": "^9.0.1"
}, },
"engines": { "engines": {
"node": ">= 10" "node": ">= 10"

View File

@@ -10,8 +10,9 @@
"tsconfig.json" "tsconfig.json"
], ],
"dependencies": { "dependencies": {
"@endo/static-module-record": "^0.8.2",
"@plugxjs/vite-plugin": "0.0.3", "@plugxjs/vite-plugin": "0.0.3",
"@swc/core": "^1.3.81", "@swc/core": "^1.3.87",
"@toeverything/infra": "workspace:^", "@toeverything/infra": "workspace:^",
"@vanilla-extract/rollup-plugin": "^1.3.0", "@vanilla-extract/rollup-plugin": "^1.3.0",
"@vitejs/plugin-vue": "^4.3.4", "@vitejs/plugin-vue": "^4.3.4",

View File

@@ -22,14 +22,15 @@
"dist" "dist"
], ],
"dependencies": { "dependencies": {
"@blocksuite/block-std": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"jotai": "^2.4.1", "jotai": "^2.4.2",
"zod": "^3.22.2" "zod": "^3.22.2"
}, },
"devDependencies": { "devDependencies": {
"vite": "^4.4.9", "vite": "^4.4.9",
"vite-plugin-dts": "3.5.3" "vite-plugin-dts": "3.5.4"
} }
} }

View File

@@ -37,7 +37,9 @@
}, },
"devDependencies": { "devDependencies": {
"@napi-rs/cli": "^3.0.0-alpha.5", "@napi-rs/cli": "^3.0.0-alpha.5",
"lib0": "^0.2.83", "lib0": "^0.2.85",
"nx": "^16.9.0",
"nx-cloud": "^16.4.0",
"yjs": "^13.6.8" "yjs": "^13.6.8"
} }
} }

View File

@@ -6,6 +6,6 @@
"dev": "wrangler dev" "dev": "wrangler dev"
}, },
"devDependencies": { "devDependencies": {
"wrangler": "^3.6.0" "wrangler": "^3.9.0"
} }
} }

View File

@@ -24,21 +24,21 @@
"@toeverything/hooks": "workspace:*", "@toeverything/hooks": "workspace:*",
"@toeverything/y-indexeddb": "workspace:*", "@toeverything/y-indexeddb": "workspace:*",
"async-call-rpc": "^6.3.1", "async-call-rpc": "^6.3.1",
"jotai": "^2.4.1", "jotai": "^2.4.2",
"js-base64": "^3.7.5", "js-base64": "^3.7.5",
"ky": "^1.0.1", "ky": "^1.0.1",
"lib0": "^0.2.83", "lib0": "^0.2.85",
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"socket.io-client": "^4.7.2", "socket.io-client": "^4.7.2",
"swr": "2.2.0", "swr": "2.2.0",
"y-protocols": "^1.0.5", "y-protocols": "^1.0.6",
"yjs": "^13.6.8", "yjs": "^13.6.8",
"zod": "^3.22.2" "zod": "^3.22.2"
}, },
"devDependencies": { "devDependencies": {
"@types/ws": "^8.5.5", "@types/ws": "^8.5.5",
"ws": "^8.13.0" "ws": "^8.14.2"
}, },
"version": "0.9.0-canary.13" "version": "0.9.0-canary.13"
} }

View File

@@ -41,7 +41,7 @@
"@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"vite": "^4.4.9", "vite": "^4.4.9",
"vite-plugin-dts": "3.5.3", "vite-plugin-dts": "3.5.4",
"y-indexeddb": "^9.0.11" "y-indexeddb": "^9.0.11"
}, },
"peerDependencies": { "peerDependencies": {

View File

@@ -21,13 +21,13 @@
"langchain": "^0.0.138", "langchain": "^0.0.138",
"marked": "^7.0.5", "marked": "^7.0.5",
"marked-gfm-heading-id": "^3.1.0", "marked-gfm-heading-id": "^3.1.0",
"marked-mangle": "^1.1.2", "marked-mangle": "^1.1.4",
"zod": "^3.22.2" "zod": "^3.22.2"
}, },
"devDependencies": { "devDependencies": {
"@affine/plugin-cli": "workspace:*", "@affine/plugin-cli": "workspace:*",
"@types/marked": "^5.0.1", "@types/marked": "^5.0.1",
"jotai": "^2.4.1", "jotai": "^2.4.2",
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0" "react-dom": "18.2.0"
}, },

View File

@@ -22,7 +22,7 @@
}, },
"devDependencies": { "devDependencies": {
"@affine/plugin-cli": "workspace:*", "@affine/plugin-cli": "workspace:*",
"jotai": "^2.4.1", "jotai": "^2.4.2",
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0" "react-dom": "18.2.0"
} }

View File

@@ -17,7 +17,7 @@
"dependencies": { "dependencies": {
"@affine/component": "workspace:*", "@affine/component": "workspace:*",
"@affine/sdk": "workspace:*", "@affine/sdk": "workspace:*",
"element-plus": "^2.3.12", "element-plus": "^2.3.14",
"vue": "^3.3.4" "vue": "^3.3.4"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -1,4 +1,6 @@
const semver = await import('../apps/server/node_modules/semver/index.js'); const semver = await import('semver').catch(() =>
import('../apps/server/node_modules/semver/index.js')
);
import packageJson from '../package.json' assert { type: 'json' }; import packageJson from '../package.json' assert { type: 'json' };

View File

@@ -1,3 +1,4 @@
import { join } from 'node:path';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { runCli } from '@magic-works/i18n-codegen'; import { runCli } from '@magic-works/i18n-codegen';
@@ -7,9 +8,7 @@ beforeAll(async () => {
await runCli( await runCli(
{ {
watch: false, watch: false,
cwd: fileURLToPath( cwd: join(fileURLToPath(import.meta.url), '../../../.i18n-codegen.json'),
new URL('../../../.i18n-codegen.json', import.meta.url)
),
}, },
error => { error => {
console.error(error); console.error(error);

View File

@@ -7,7 +7,7 @@
"devDependencies": { "devDependencies": {
"@affine-test/fixtures": "workspace:*", "@affine-test/fixtures": "workspace:*",
"@affine-test/kit": "workspace:*", "@affine-test/kit": "workspace:*",
"@playwright/test": "^1.37.1" "@playwright/test": "^1.38.1"
}, },
"version": "0.9.0-canary.13" "version": "0.9.0-canary.13"
} }

View File

@@ -7,8 +7,8 @@
"devDependencies": { "devDependencies": {
"@affine-test/fixtures": "workspace:*", "@affine-test/fixtures": "workspace:*",
"@affine-test/kit": "workspace:*", "@affine-test/kit": "workspace:*",
"@playwright/test": "^1.37.1", "@playwright/test": "^1.38.1",
"@types/fs-extra": "^11.0.1", "@types/fs-extra": "^11.0.2",
"fs-extra": "^11.1.1" "fs-extra": "^11.1.1"
}, },
"version": "0.9.0-canary.13" "version": "0.9.0-canary.13"

View File

@@ -7,9 +7,10 @@
"devDependencies": { "devDependencies": {
"@affine-test/fixtures": "workspace:*", "@affine-test/fixtures": "workspace:*",
"@affine-test/kit": "workspace:*", "@affine-test/kit": "workspace:*",
"@playwright/test": "^1.37.1", "@playwright/test": "^1.38.1",
"@types/fs-extra": "^11.0.1", "@types/fs-extra": "^11.0.2",
"fs-extra": "^11.1.1" "fs-extra": "^11.1.1",
"playwright": "^1.38.1"
}, },
"version": "0.9.0-canary.13" "version": "0.9.0-canary.13"
} }

View File

@@ -1,3 +1,4 @@
static static
fixtures/*.ydoc fixtures/*.ydoc
test-results test-results
*.zip

View File

@@ -2,7 +2,7 @@
"name": "@affine-legacy/0.7.0-canary.18", "name": "@affine-legacy/0.7.0-canary.18",
"description": "AFFiNE 0.7.0-canary.18 static output", "description": "AFFiNE 0.7.0-canary.18 static output",
"scripts": { "scripts": {
"unzip": "unzip affine-web -d static", "unzip": "wget -O static.zip https://github.com/toeverything/AFFiNE/releases/download/v0.7.0-canary.18/web-static.zip && unzip static.zip -d static",
"start": "yarn exec serve -s static -l 8082", "start": "yarn exec serve -s static -l 8082",
"e2e": "yarn playwright test", "e2e": "yarn playwright test",
"test": "vitest --run" "test": "vitest --run"
@@ -14,7 +14,7 @@
"@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"@playwright/test": "^1.37.1", "@playwright/test": "^1.38.1",
"express": "^4.18.2", "express": "^4.18.2",
"http-proxy-middleware": "^3.0.0-beta.1", "http-proxy-middleware": "^3.0.0-beta.1",
"serve": "^14.2.1" "serve": "^14.2.1"

View File

@@ -1,3 +1,5 @@
static static
web-static
fixtures/*.ydoc fixtures/*.ydoc
test-results test-results
*.zip

View File

@@ -1,4 +1,4 @@
import { resolve } from 'node:path'; import { join } from 'node:path';
import { clickEdgelessModeButton } from '@affine-test/kit/utils/editor'; import { clickEdgelessModeButton } from '@affine-test/kit/utils/editor';
import { waitForEditorLoad } from '@affine-test/kit/utils/page-logic'; import { waitForEditorLoad } from '@affine-test/kit/utils/page-logic';
@@ -10,7 +10,7 @@ import { expect, test } from '@playwright/test';
const { switchToNext } = setupProxyServer( const { switchToNext } = setupProxyServer(
test, test,
resolve(__dirname, '..', 'static') join(__dirname, '..', 'web-static')
); );
test('database migration', async ({ page, context }) => { test('database migration', async ({ page, context }) => {

View File

@@ -2,8 +2,8 @@
"name": "@affine-legacy/0.8.0-canary.7", "name": "@affine-legacy/0.8.0-canary.7",
"description": "AFFiNE 0.8.0-canary.7 static output", "description": "AFFiNE 0.8.0-canary.7 static output",
"scripts": { "scripts": {
"unzip": "unzip affine-core -d static", "unzip": "wget -O static.zip https://github.com/toeverything/AFFiNE/releases/download/v0.8.0-canary.7/web-static.zip && unzip static.zip",
"start": "yarn exec serve -s static -l 8082", "start": "yarn exec serve -s web-static -l 8082",
"e2e": "yarn playwright test" "e2e": "yarn playwright test"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -1,3 +1,5 @@
static static
fixtures/*.ydoc fixtures/*.ydoc
test-results test-results
*.zip
web-static

View File

@@ -1,4 +1,4 @@
import { resolve } from 'node:path'; import { join } from 'node:path';
import { clickEdgelessModeButton } from '@affine-test/kit/utils/editor'; import { clickEdgelessModeButton } from '@affine-test/kit/utils/editor';
import { import {
@@ -13,7 +13,7 @@ import { expect, test } from '@playwright/test';
const { switchToNext } = setupProxyServer( const { switchToNext } = setupProxyServer(
test, test,
resolve(__dirname, '..', 'static') join(__dirname, '..', 'web-static')
); );
test('surface migration', async ({ page, context }) => { test('surface migration', async ({ page, context }) => {

View File

@@ -1,9 +1,9 @@
{ {
"name": "@affine-legacy/0.8.3", "name": "@affine-legacy/0.8.4",
"description": "AFFiNE 0.8.3 static output", "description": "AFFiNE 0.8.4 static output",
"scripts": { "scripts": {
"unzip": "unzip affine-core -d static", "unzip": "wget -O static.zip https://github.com/toeverything/AFFiNE/releases/download/v0.8.4/web-static.zip && unzip static.zip",
"start": "yarn exec serve -s static -l 8082", "start": "yarn exec serve -s web-static -l 8082",
"e2e": "yarn playwright test" "e2e": "yarn playwright test"
}, },
"devDependencies": { "devDependencies": {
@@ -13,7 +13,7 @@
"@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"@playwright/test": "^1.37.1", "@playwright/test": "^1.38.1",
"express": "^4.18.2", "express": "^4.18.2",
"http-proxy-middleware": "^3.0.0-beta.1", "http-proxy-middleware": "^3.0.0-beta.1",
"serve": "^14.2.1" "serve": "^14.2.1"

View File

@@ -5,7 +5,7 @@ import type {
const config: PlaywrightTestConfig = { const config: PlaywrightTestConfig = {
testDir: './e2e', testDir: './e2e',
fullyParallel: true, fullyParallel: !process.env.CI,
timeout: process.env.CI ? 50_000 : 30_000, timeout: process.env.CI ? 50_000 : 30_000,
use: { use: {
baseURL: 'http://localhost:8081/', baseURL: 'http://localhost:8081/',
@@ -20,7 +20,7 @@ const config: PlaywrightTestConfig = {
video: 'on-first-retry', video: 'on-first-retry',
}, },
forbidOnly: !!process.env.CI, forbidOnly: !!process.env.CI,
workers: 4, workers: process.env.CI ? 1 : 4,
retries: 1, retries: 1,
reporter: process.env.CI ? 'github' : 'list', reporter: process.env.CI ? 'github' : 'list',
webServer: [ webServer: [
@@ -39,7 +39,6 @@ const config: PlaywrightTestConfig = {
if (process.env.CI) { if (process.env.CI) {
config.retries = 3; config.retries = 3;
config.workers = '50%';
} }
export default config; export default config;

View File

@@ -7,7 +7,7 @@
"devDependencies": { "devDependencies": {
"@affine-test/fixtures": "workspace:*", "@affine-test/fixtures": "workspace:*",
"@affine-test/kit": "workspace:*", "@affine-test/kit": "workspace:*",
"@playwright/test": "^1.37.1" "@playwright/test": "^1.38.1"
}, },
"version": "0.9.0-canary.13" "version": "0.9.0-canary.13"
} }

View File

@@ -7,7 +7,7 @@
"devDependencies": { "devDependencies": {
"@affine-test/fixtures": "workspace:*", "@affine-test/fixtures": "workspace:*",
"@affine-test/kit": "workspace:*", "@affine-test/kit": "workspace:*",
"@playwright/test": "^1.37.1" "@playwright/test": "^1.38.1"
}, },
"version": "0.9.0-canary.13" "version": "0.9.0-canary.13"
} }

View File

@@ -14,8 +14,8 @@ import {
} from './playwright'; } from './playwright';
import { removeWithRetry } from './utils/utils'; import { removeWithRetry } from './utils/utils';
const projectRoot = resolve(__dirname, '..', '..'); const projectRoot = join(__dirname, '..', '..');
const electronRoot = resolve(projectRoot, 'apps', 'electron'); const electronRoot = join(projectRoot, 'apps', 'electron');
function generateUUID() { function generateUUID() {
return crypto.randomUUID(); return crypto.randomUUID();
@@ -99,7 +99,7 @@ export const test = base.extend<{
args: [clonedDist], args: [clonedDist],
env, env,
executablePath: resolve( executablePath: resolve(
electronRoot, projectRoot,
'node_modules', 'node_modules',
'.bin', '.bin',
`electron${ext}` `electron${ext}`

View File

@@ -10,7 +10,7 @@
}, },
"devDependencies": { "devDependencies": {
"@node-rs/argon2": "^1.5.2", "@node-rs/argon2": "^1.5.2",
"@playwright/test": "^1.37.1", "@playwright/test": "^1.38.1",
"express": "^4.18.2", "express": "^4.18.2",
"http-proxy-middleware": "^3.0.0-beta.1" "http-proxy-middleware": "^3.0.0-beta.1"
}, },

View File

@@ -178,6 +178,9 @@
{ {
"path": "./tests/affine-legacy/0.7.0-canary.18" "path": "./tests/affine-legacy/0.7.0-canary.18"
}, },
{
"path": "./tests/affine-legacy/0.8.0-canary.7"
},
{ {
"path": "./tests/affine-cloud" "path": "./tests/affine-cloud"
}, },
@@ -185,10 +188,7 @@
"path": "./tests/affine-desktop" "path": "./tests/affine-desktop"
}, },
{ {
"path": "./tests/affine-legacy/0.8.0-canary.7" "path": "./tests/affine-legacy/0.8.4"
},
{
"path": "./tests/affine-legacy/0.8.3"
} }
], ],
"files": [], "files": [],

4493
yarn.lock

File diff suppressed because it is too large Load Diff