mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-22 07:12:35 +03:00
refactor: use yarn (#1619)
This commit is contained in:
parent
f6c1423361
commit
fe2d244460
29
.github/workflows/build-test-version.yml
vendored
29
.github/workflows/build-test-version.yml
vendored
@ -24,40 +24,39 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: pnpm/action-setup@v2
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
registry-url: https://npm.pkg.github.com
|
||||
scope: '@toeverything'
|
||||
cache: 'pnpm'
|
||||
cache: 'yarn'
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||
|
||||
- run: node scripts/module-resolve/ci.cjs
|
||||
|
||||
- name: Restore cache
|
||||
uses: actions/cache@v3
|
||||
- uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: |
|
||||
.next/cache
|
||||
# Generate a new cache whenever packages or source files change.
|
||||
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
|
||||
# If source files changed but packages didn't, rebuild from a prior cache.
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- run: pnpm i --no-frozen-lockfile
|
||||
- run: yarn install
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_GITHUB_AUTH_TOKEN }}
|
||||
|
||||
- name: Lint
|
||||
run: |
|
||||
pnpm lint --max-warnings=0
|
||||
yarn lint --max-warnings=0
|
||||
|
||||
# - name: Test
|
||||
# run: pnpm test
|
||||
# run: yarn test
|
||||
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
run: yarn build
|
||||
env:
|
||||
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
|
||||
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}
|
||||
@ -68,7 +67,7 @@ jobs:
|
||||
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
|
||||
|
||||
- name: Export
|
||||
run: pnpm export
|
||||
run: yarn export
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
|
135
.github/workflows/build.yml
vendored
135
.github/workflows/build.yml
vendored
@ -23,28 +23,27 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: pnpm/action-setup@v2
|
||||
- uses: actions/setup-node@v3
|
||||
- name: Use Node.js LTS
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Restore cache
|
||||
uses: actions/cache@v3
|
||||
cache: 'yarn'
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||
- uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: |
|
||||
apps/web/.next/cache
|
||||
# Generate a new cache whenever packages or source files change.
|
||||
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
|
||||
# If source files changed but packages didn't, rebuild from a prior cache.
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- run: pnpm i
|
||||
- run: pnpm lint --max-warnings=0
|
||||
- run: yarn install
|
||||
- run: yarn lint --max-warnings=0
|
||||
|
||||
- name: Build
|
||||
run: pnpm i && pnpm build
|
||||
run: yarn build
|
||||
env:
|
||||
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
|
||||
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}
|
||||
@ -55,7 +54,7 @@ jobs:
|
||||
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
|
||||
|
||||
- name: Export
|
||||
run: pnpm export
|
||||
run: yarn export
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
@ -90,13 +89,22 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: pnpm/action-setup@v2
|
||||
- uses: actions/setup-node@v3
|
||||
- name: Use Node.js 18
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'pnpm'
|
||||
- run: pnpm i
|
||||
|
||||
cache: 'yarn'
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||
- uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- run: yarn install
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
@ -106,12 +114,12 @@ jobs:
|
||||
- name: Install playwright browsers
|
||||
run: npx playwright install chromium
|
||||
- name: Run playwright tests
|
||||
run: pnpm test -- --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }}
|
||||
run: yarn test --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }}
|
||||
env:
|
||||
COVERAGE: true
|
||||
|
||||
- name: Collect code coverage report
|
||||
run: pnpm exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcov
|
||||
run: yarn exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcov
|
||||
|
||||
- name: Upload e2e test coverage results
|
||||
uses: codecov/codecov-action@v3
|
||||
@ -138,13 +146,22 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: pnpm/action-setup@v2
|
||||
- uses: actions/setup-node@v3
|
||||
- name: Use Node.js LTS
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'pnpm'
|
||||
- run: pnpm i
|
||||
|
||||
cache: 'yarn'
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||
- uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- run: yarn install
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
@ -152,7 +169,7 @@ jobs:
|
||||
path: ./apps/web/.next
|
||||
|
||||
- name: Unit Test
|
||||
run: pnpm run test:unit:coverage
|
||||
run: yarn run test:unit:coverage
|
||||
|
||||
- name: Upload unit test coverage results
|
||||
uses: codecov/codecov-action@v3
|
||||
@ -171,33 +188,32 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: pnpm/action-setup@v2
|
||||
- uses: actions/setup-node@v3
|
||||
- name: Use Node.js LTS
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
registry-url: https://npm.pkg.github.com
|
||||
scope: '@toeverything'
|
||||
cache: 'pnpm'
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||
- uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- run: node scripts/module-resolve/ci.cjs
|
||||
|
||||
- name: Restore cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
.next/cache
|
||||
# Generate a new cache whenever packages or source files change.
|
||||
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
|
||||
# If source files changed but packages didn't, rebuild from a prior cache.
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
|
||||
|
||||
- run: pnpm i --no-frozen-lockfile
|
||||
- run: yarn install
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_GITHUB_AUTH_TOKEN }}
|
||||
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
run: yarn build
|
||||
env:
|
||||
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
|
||||
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}
|
||||
@ -208,7 +224,7 @@ jobs:
|
||||
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
|
||||
|
||||
- name: Export
|
||||
run: pnpm export
|
||||
run: yarn export
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
@ -286,13 +302,22 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: pnpm/action-setup@v2
|
||||
- uses: actions/setup-node@v3
|
||||
- name: Use Node.js 18
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'pnpm'
|
||||
- run: pnpm i
|
||||
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||
- uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- run: yarn install
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
@ -303,13 +328,13 @@ jobs:
|
||||
run: npx playwright install chromium
|
||||
- name: Run e2e & unit tests
|
||||
run: |
|
||||
pnpm test -- --forbid-only
|
||||
pnpm run test:unit:coverage
|
||||
yarn test --forbid-only
|
||||
yarn run test:unit:coverage
|
||||
env:
|
||||
COVERAGE: true
|
||||
|
||||
- name: Collect code coverage report
|
||||
run: pnpm exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcov
|
||||
run: yarn exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcov
|
||||
|
||||
- name: Upload e2e test coverage results
|
||||
uses: codecov/codecov-action@v3
|
||||
|
14
.github/workflows/client-app.yml
vendored
14
.github/workflows/client-app.yml
vendored
@ -34,14 +34,18 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: pnpm/action-setup@v2
|
||||
- uses: actions/setup-node@v3
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||
- uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'pnpm'
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- name: Install dependencies
|
||||
run: yarn install
|
||||
working-directory: apps/electron
|
||||
|
||||
- name: before-make
|
||||
working-directory: apps/electron
|
||||
|
39
.github/workflows/compressed-size.yml
vendored
39
.github/workflows/compressed-size.yml
vendored
@ -1,39 +0,0 @@
|
||||
name: Compressed Size
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: pnpm/action-setup@v2
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
registry-url: https://npm.pkg.github.com
|
||||
scope: '@toeverything'
|
||||
cache: 'pnpm'
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
${{ github.workspace }}/apps/web/.next/cache
|
||||
key: ${{ runner.os }}-affine-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-affine-${{ hashFiles('**/pnpm-lock.yaml') }}-
|
||||
- name: Build
|
||||
run: |
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run build
|
||||
- uses: preactjs/compressed-size-action@v2
|
||||
env:
|
||||
ENABLE_DEBUG_PAGE: ''
|
||||
with:
|
||||
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
||||
build-script: 'export'
|
||||
pattern: 'apps/web/out/**/*.{js,css,html,json}'
|
||||
compression: 'brotli'
|
20
.github/workflows/languages-sync.yml
vendored
20
.github/workflows/languages-sync.yml
vendored
@ -26,23 +26,27 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: pnpm/action-setup@v2
|
||||
- uses: actions/setup-node@v3
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||
- uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'pnpm'
|
||||
- run: pnpm i
|
||||
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- run: yarn install
|
||||
- name: Check Language Key
|
||||
if: github.ref != 'refs/heads/master'
|
||||
working-directory: ./packages/i18n
|
||||
run: pnpm run sync-languages:check
|
||||
run: yarn run sync-languages:check
|
||||
env:
|
||||
TOLGEE_API_KEY: ${{ secrets.TOLGEE_API_KEY }}
|
||||
|
||||
- name: Sync Languages
|
||||
if: github.ref == 'refs/heads/master'
|
||||
working-directory: ./packages/i18n
|
||||
run: pnpm run sync-languages
|
||||
run: yarn run sync-languages
|
||||
env:
|
||||
TOLGEE_API_KEY: ${{ secrets.TOLGEE_API_KEY }}
|
||||
|
28
.github/workflows/publish.yml
vendored
28
.github/workflows/publish.yml
vendored
@ -20,29 +20,23 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: pnpm/action-setup@v2
|
||||
- uses: actions/setup-node@v3
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||
- uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Restore cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
.next/cache
|
||||
# Generate a new cache whenever packages or source files change.
|
||||
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
|
||||
# If source files changed but packages didn't, rebuild from a prior cache.
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- run: pnpm i
|
||||
- run: yarn install
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_GITHUB_AUTH_TOKEN }}
|
||||
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
run: yarn build
|
||||
env:
|
||||
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
|
||||
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}
|
||||
@ -53,7 +47,7 @@ jobs:
|
||||
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
|
||||
|
||||
- name: Export
|
||||
run: pnpm export
|
||||
run: yarn export
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
|
61
.github/workflows/update-block-suite.yml
vendored
61
.github/workflows/update-block-suite.yml
vendored
@ -1,61 +0,0 @@
|
||||
name: Update block-suite version
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# At 02:00 UTC
|
||||
- cron: '0 2 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
# Cancels all previous workflow runs for pull requests that have not completed.
|
||||
# See https://docs.github.com/en/actions/using-jobs/using-concurrency
|
||||
concurrency:
|
||||
# The concurrency group contains the workflow name and the branch name for
|
||||
# pull requests or the commit hash for any other events.
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: pnpm/action-setup@v2
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'pnpm'
|
||||
- run: pnpm i
|
||||
|
||||
- name: Get old version
|
||||
id: old-version
|
||||
run: |
|
||||
PACKAGE_VERSION=$(cat apps/web/package.json | jq '.dependencies["@blocksuite/editor"]' | tr -d '"')
|
||||
echo "old-version=${PACKAGE_VERSION}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Update block-suite version
|
||||
run: pnpm update:core
|
||||
|
||||
- name: Get new version
|
||||
id: new-version
|
||||
run: |
|
||||
PACKAGE_VERSION=$(cat apps/web/package.json | jq '.dependencies["@blocksuite/editor"]' | tr -d '"')
|
||||
echo "new-version=${PACKAGE_VERSION}" >> $GITHUB_OUTPUT
|
||||
|
||||
# https://github.com/actions-js/push
|
||||
- name: Commit push
|
||||
uses: actions-js/push@master
|
||||
with:
|
||||
github_token: '${{ secrets.GITHUB_TOKEN }}'
|
||||
message: 'chore: bump blocksuite from ${{ steps.old-version.outputs.old-version }} to ${{ steps.new-version.outputs.new-version }}'
|
||||
force: true
|
||||
branch: refs/heads/bot/bump-core
|
||||
|
||||
# see https://github.com/repo-sync/pull-request
|
||||
- name: Create Pull Request
|
||||
uses: repo-sync/pull-request@v2
|
||||
with:
|
||||
source_branch: bot/bump-core
|
||||
pr_title: 'Bump blocksuite to ${{ steps.new-version.outputs.new-version }}'
|
||||
pr_body: 'Please carefully check the editor functionality before merging the PR.'
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
7
.gitignore
vendored
7
.gitignore
vendored
@ -1,4 +1,11 @@
|
||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
.pnp.*
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
|
||||
# compiled output
|
||||
*dist
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
pnpm exec lint-staged
|
||||
yarn exec lint-staged
|
||||
|
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -2,7 +2,7 @@
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"command": "pnpm run dev",
|
||||
"command": "yarn run dev",
|
||||
"name": "Run Dev",
|
||||
"request": "launch",
|
||||
"type": "node-terminal"
|
||||
|
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -1,5 +1,5 @@
|
||||
{
|
||||
"eslint.packageManager": "pnpm",
|
||||
"eslint.packageManager": "yarn",
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnSaveMode": "file",
|
||||
@ -7,7 +7,7 @@
|
||||
"blocksuite",
|
||||
"datacenter",
|
||||
"livedemo",
|
||||
"pnpm",
|
||||
"yarn",
|
||||
"jwst",
|
||||
"testid",
|
||||
"octobase",
|
||||
|
541
.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
Normal file
541
.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
Normal file
File diff suppressed because one or more lines are too long
516
apps/electron/.yarn/releases/yarn-3.4.1.cjs → .yarn/releases/yarn-3.5.0.cjs
vendored
Normal file → Executable file
516
apps/electron/.yarn/releases/yarn-3.4.1.cjs → .yarn/releases/yarn-3.5.0.cjs
vendored
Normal file → Executable file
File diff suppressed because one or more lines are too long
15
.yarnrc.yml
Normal file
15
.yarnrc.yml
Normal file
@ -0,0 +1,15 @@
|
||||
nmMode: hardlinks-local
|
||||
|
||||
nodeLinker: node-modules
|
||||
|
||||
npmAuthToken: '${NODE_AUTH_TOKEN:-NONE}'
|
||||
|
||||
npmPublishAccess: public
|
||||
|
||||
npmPublishRegistry: 'https://registry.npmjs.org'
|
||||
|
||||
plugins:
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||
spec: '@yarnpkg/plugin-interactive-tools'
|
||||
|
||||
yarnPath: .yarn/releases/yarn-3.5.0.cjs
|
@ -16,12 +16,12 @@
|
||||
"dependencies": {
|
||||
"@blocksuite/blocks": "0.5.0-20230320034723-8dfc65e",
|
||||
"@blocksuite/editor": "0.5.0-20230320034723-8dfc65e",
|
||||
"@blocksuite/icons": "2.0.17",
|
||||
"@blocksuite/icons": "2.0.23",
|
||||
"@blocksuite/store": "0.5.0-20230320034723-8dfc65e",
|
||||
"@emotion/react": "^11.10.6",
|
||||
"@emotion/styled": "^11.10.6",
|
||||
"@tauri-apps/api": "^1.2.0",
|
||||
"json-schema-to-typescript": "^11.0.5",
|
||||
"json-schema-to-typescript": "^12.0.0",
|
||||
"lib0": "^0.2.69",
|
||||
"next": "=13.2.3",
|
||||
"react": "^18.2.0",
|
||||
@ -34,13 +34,13 @@
|
||||
"@types/node": "^18.15.3",
|
||||
"@types/react": "^18.0.28",
|
||||
"@types/react-dom": "^18.0.11",
|
||||
"esbuild": "^0.17.8",
|
||||
"esbuild": "^0.17.12",
|
||||
"lit": "^2.6.1",
|
||||
"prettier": "2.8.4",
|
||||
"rimraf": "^4.1.3",
|
||||
"prettier": "2.8.5",
|
||||
"rimraf": "^4.4.0",
|
||||
"typescript": "^5.0.2",
|
||||
"typesync": "^0.10.0",
|
||||
"vite": "^4.2.0",
|
||||
"zx": "^7.2.0"
|
||||
"zx": "^7.2.1"
|
||||
}
|
||||
}
|
||||
|
@ -32,12 +32,11 @@
|
||||
"@electron/rebuild": "^3.2.10",
|
||||
"dts-for-context-bridge": "^0.7.1",
|
||||
"electron": "23.1.4",
|
||||
"esbuild": "^0.17.8",
|
||||
"zx": "^7.2.0"
|
||||
"esbuild": "^0.17.12",
|
||||
"zx": "^7.2.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"cross-env": "7.0.3",
|
||||
"electron-window-state": "^5.0.3"
|
||||
},
|
||||
"packageManager": "yarn@3.4.1"
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -57,7 +57,7 @@ const nextConfig = {
|
||||
experimental: {
|
||||
swcPlugins: [
|
||||
process.env.COVERAGE === 'true' && ['swc-plugin-coverage-instrument', {}],
|
||||
['@swc-jotai/debug-label', {}],
|
||||
// ['@swc-jotai/debug-label', {}],
|
||||
// ['@swc-jotai/react-refresh', {}],
|
||||
].filter(Boolean),
|
||||
},
|
||||
|
@ -24,34 +24,33 @@
|
||||
"@emotion/server": "^11.10.0",
|
||||
"@emotion/styled": "^11.10.6",
|
||||
"@mui/material": "^5.11.13",
|
||||
"cmdk": "^0.1.22",
|
||||
"cmdk": "^0.2.0",
|
||||
"css-spring": "^4.1.0",
|
||||
"dayjs": "^1.11.7",
|
||||
"jotai": "^2.0.3",
|
||||
"jotai-devtools": "^0.2.0",
|
||||
"lit": "^2.6.1",
|
||||
"lottie-web": "^5.10.2",
|
||||
"next-themes": "^0.2.1",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-is": "^18.2.0",
|
||||
"swr": "^2.0.4",
|
||||
"swr": "^2.1.0",
|
||||
"y-indexeddb": "^9.0.9",
|
||||
"y-protocols": "^1.0.5",
|
||||
"yjs": "^13.5.50",
|
||||
"zod": "^3.21.3"
|
||||
"zod": "^3.21.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@perfsee/webpack": "^1.3.0",
|
||||
"@perfsee/webpack": "^1.5.0",
|
||||
"@redux-devtools/extension": "^3.2.5",
|
||||
"@swc-jotai/debug-label": "^0.0.6",
|
||||
"@swc-jotai/react-refresh": "^0.0.4",
|
||||
"@swc-jotai/debug-label": "^0.0.9",
|
||||
"@swc-jotai/react-refresh": "^0.0.7",
|
||||
"@types/react": "^18.0.28",
|
||||
"@types/react-dom": "^18.0.11",
|
||||
"@types/webpack-env": "^1.18.0",
|
||||
"dotenv": "^16.0.3",
|
||||
"eslint": "^8.36.0",
|
||||
"eslint-config-next": "^13.2.3",
|
||||
"eslint-config-next": "^13.2.4",
|
||||
"next": "=13.2.3",
|
||||
"next-debug-local": "^0.1.5",
|
||||
"next-router-mock": "^0.9.2",
|
||||
|
@ -5,12 +5,11 @@ import { createI18n, I18nextProvider } from '@affine/i18n';
|
||||
import type { EmotionCache } from '@emotion/cache';
|
||||
import { CacheProvider } from '@emotion/react';
|
||||
import { Provider } from 'jotai';
|
||||
import { useAtomsDebugValue } from 'jotai-devtools';
|
||||
import type { AppProps } from 'next/app';
|
||||
import Head from 'next/head';
|
||||
import { useRouter } from 'next/router';
|
||||
import type { ReactElement } from 'react';
|
||||
import React, { memo, Suspense, useEffect, useMemo } from 'react';
|
||||
import React, { Suspense, useEffect, useMemo } from 'react';
|
||||
|
||||
import { jotaiStore } from '../atoms';
|
||||
import { AffineErrorBoundary } from '../components/affine/affine-error-eoundary';
|
||||
@ -30,11 +29,6 @@ type AppPropsWithLayout = AppProps & {
|
||||
|
||||
const EmptyLayout = (page: ReactElement) => page;
|
||||
|
||||
const DebugAtoms = memo(function DebugAtoms() {
|
||||
useAtomsDebugValue();
|
||||
return null;
|
||||
});
|
||||
|
||||
const clientSideEmotionCache = createEmotionCache();
|
||||
const helmetContext = {};
|
||||
|
||||
@ -58,7 +52,6 @@ const App = function App({
|
||||
return (
|
||||
<CacheProvider value={emotionCache}>
|
||||
<I18nextProvider i18n={i18n}>
|
||||
<DebugAtoms />
|
||||
<MessageCenter />
|
||||
<AffineErrorBoundary router={useRouter()}>
|
||||
<Suspense fallback={<PageLoading key="RootPageLoading" />}>
|
||||
|
@ -27,7 +27,7 @@ pnpm dev:app
|
||||
|
||||
## Build
|
||||
|
||||
To build the desktop client application, run `pnpm build:app` in `apps/desktop`.
|
||||
To build the desktop client application, run `yarn build:app` in `apps/desktop`.
|
||||
Once the build is complete, you can find the paths to the binaries in the terminal output.
|
||||
|
||||
```
|
||||
|
52
package.json
52
package.json
@ -4,26 +4,29 @@
|
||||
"private": true,
|
||||
"author": "toeverything",
|
||||
"license": "MPL-2.0",
|
||||
"workspaces": [
|
||||
"apps/*",
|
||||
"packages/*"
|
||||
],
|
||||
"scripts": {
|
||||
"dev": "pnpm --filter @affine/app dev",
|
||||
"dev:ac": "NODE_API_SERVER=ac pnpm --filter @affine/app dev",
|
||||
"dev:local": "NODE_API_SERVER=local pnpm --filter @affine/app dev",
|
||||
"dev:app": "pnpm --filter @affine/electron dev:app",
|
||||
"build": "pnpm --filter @affine/app build",
|
||||
"build:client": "pnpm --filter @affine/client-app build:app",
|
||||
"build:storybook": "pnpm -r build-storybook",
|
||||
"export": "pnpm --filter @affine/app export",
|
||||
"start": "pnpm --filter @affine/app start",
|
||||
"dev": "yarn workspace @affine/app dev",
|
||||
"dev:ac": "NODE_API_SERVER=ac yarn workspace @affine/app dev",
|
||||
"dev:local": "NODE_API_SERVER=local yarn workspace @affine/app dev",
|
||||
"dev:app": "yarn workspace @affine/electron dev:app",
|
||||
"build": "yarn workspace @affine/app build",
|
||||
"build:client": "yarn workspace @affine/client-app build:app",
|
||||
"build:storybook": "yarn workspace @affine/component build-storybook",
|
||||
"export": "yarn workspace @affine/app export",
|
||||
"start": "yarn workspace @affine/app start",
|
||||
"lint": "eslint . --ext .js,mjs,.ts,.tsx",
|
||||
"lint:fix": "pnpm lint --fix",
|
||||
"lint:fix": "yarn lint --fix",
|
||||
"test": "playwright test",
|
||||
"test:coverage": "COVERAGE=true pnpm test -- --forbid-only",
|
||||
"test:coverage": "COVERAGE=true yarn test --forbid-only",
|
||||
"test:unit": "vitest --run",
|
||||
"test:unit:ui": "vitest --ui",
|
||||
"test:unit:coverage": "vitest run --coverage",
|
||||
"postinstall": "husky install",
|
||||
"notify": "node scripts/notify.mjs",
|
||||
"update:core": "pnpm up '@blocksuite/*@nightly' !@blocksuite/icons -r"
|
||||
"notify": "node scripts/notify.mjs"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*": "prettier --write --ignore-unknown",
|
||||
@ -38,7 +41,7 @@
|
||||
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
||||
"@typescript-eslint/parser": "^5.55.0",
|
||||
"@vitejs/plugin-react": "^3.1.0",
|
||||
"@vitest/coverage-istanbul": "^0.28.5",
|
||||
"@vitest/coverage-istanbul": "^0.29.3",
|
||||
"@vitest/ui": "^0.29.3",
|
||||
"eslint": "^8.36.0",
|
||||
"eslint-config-prettier": "^8.7.0",
|
||||
@ -53,28 +56,13 @@
|
||||
"husky": "^8.0.3",
|
||||
"lint-staged": "^13.2.0",
|
||||
"nyc": "^15.1.0",
|
||||
"prettier": "^2.8.4",
|
||||
"prettier": "^2.8.5",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"typescript": "^5.0.2",
|
||||
"vite": "^4.2.0",
|
||||
"vitest": "^0.28.5",
|
||||
"vitest": "^0.29.3",
|
||||
"vitest-fetch-mock": "^0.2.2"
|
||||
},
|
||||
"pnpm": {
|
||||
"patchedDependencies": {
|
||||
"@tauri-apps/api@1.2.0": "patches/@tauri-apps__api@1.2.0.patch"
|
||||
},
|
||||
"overrides": {
|
||||
"react-is": "^18.2.0",
|
||||
"@storybook/addons": "^7.0.0-rc.1",
|
||||
"@storybook/api": "^7.0.0-rc.1",
|
||||
"@storybook/components": "^7.0.0-rc.1",
|
||||
"@storybook/core-events": "^7.0.0-rc.1",
|
||||
"@storybook/global": "^5.0.0",
|
||||
"@storybook/theming": "^7.0.0-rc.1",
|
||||
"jest-mock": "^29.5.0"
|
||||
}
|
||||
},
|
||||
"packageManager": "pnpm@7.28.0"
|
||||
"packageManager": "yarn@3.5.0"
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
||||
"@storybook/addon-interactions": "7.0.0-rc.1",
|
||||
"@storybook/addon-links": "7.0.0-rc.1",
|
||||
"@storybook/builder-vite": "7.0.0-rc.1",
|
||||
"@storybook/jest": "0.0.11-next.0",
|
||||
"@storybook/jest": "0.0.10",
|
||||
"@storybook/react": "7.0.0-rc.1",
|
||||
"@storybook/react-vite": "7.0.0-rc.1",
|
||||
"@storybook/test-runner": "0.10.0-next.11",
|
||||
@ -47,7 +47,7 @@
|
||||
"@types/react": "^18.0.28",
|
||||
"@types/react-dom": "18.0.11",
|
||||
"@vitejs/plugin-react": "^3.1.0",
|
||||
"jest-mock": "^28.1.3",
|
||||
"jest-mock": "^29.5.0",
|
||||
"storybook": "7.0.0-rc.1",
|
||||
"storybook-dark-mode-v7": "3.0.0-alpha.0",
|
||||
"typescript": "^5.0.2",
|
||||
|
@ -1,75 +0,0 @@
|
||||
import type { GetBlob, PutBlob } from '../ipc/types/blob';
|
||||
import type {
|
||||
GetDocumentParameter,
|
||||
GetDocumentResponse,
|
||||
YDocumentUpdate,
|
||||
} from '../ipc/types/document';
|
||||
import type { CreateUser, GetUserParameters, User } from '../ipc/types/user';
|
||||
import type {
|
||||
CreateWorkspace,
|
||||
CreateWorkspaceResult,
|
||||
GetWorkspace,
|
||||
GetWorkspaceResult,
|
||||
GetWorkspaces,
|
||||
GetWorkspacesResult,
|
||||
} from '../ipc/types/workspace';
|
||||
|
||||
export const updateYDocument = async (parameters: YDocumentUpdate) =>
|
||||
await true;
|
||||
|
||||
export const getYDocument = async (
|
||||
parameters: GetDocumentParameter
|
||||
): Promise<GetDocumentResponse> =>
|
||||
await {
|
||||
updates: [],
|
||||
};
|
||||
|
||||
export const createWorkspace = async (
|
||||
parameters: CreateWorkspace
|
||||
): Promise<CreateWorkspaceResult> => await { id: 'xxx', name: 'xxx' };
|
||||
|
||||
export const getWorkspaces = async (
|
||||
parameters: GetWorkspaces
|
||||
): Promise<GetWorkspacesResult> =>
|
||||
await {
|
||||
workspaces: [],
|
||||
};
|
||||
|
||||
export const getWorkspace = async (
|
||||
parameters: GetWorkspace
|
||||
): Promise<GetWorkspaceResult> =>
|
||||
await {
|
||||
workspace: {
|
||||
created_at: 0,
|
||||
id: '',
|
||||
member_count: 1,
|
||||
public: true,
|
||||
type: 0,
|
||||
},
|
||||
};
|
||||
|
||||
export const putBlob = async (parameters: PutBlob): Promise<string> =>
|
||||
await 'path/xxx';
|
||||
|
||||
export const getBlob = async (parameters: GetBlob): Promise<number[]> =>
|
||||
await [];
|
||||
|
||||
/**
|
||||
* This will create a private workspace too.
|
||||
* @returns
|
||||
*/
|
||||
export const createUser = async (parameters: CreateUser): Promise<User> =>
|
||||
await {
|
||||
created_at: 0,
|
||||
id: '1',
|
||||
email: 'xxx@xxx.xxx',
|
||||
name: 'xxx',
|
||||
};
|
||||
|
||||
export const getUser = async (parameters: GetUserParameters): Promise<User> =>
|
||||
await {
|
||||
created_at: 0,
|
||||
id: '1',
|
||||
email: 'xxx@xxx.xxx',
|
||||
name: 'xxx',
|
||||
};
|
@ -1,55 +0,0 @@
|
||||
import 'fake-indexeddb/auto';
|
||||
|
||||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { MessageCenter } from '../../../message';
|
||||
import { WorkspaceUnitCollection } from '../../../workspace-unit-collection';
|
||||
import { TauriIPCProvider } from '..';
|
||||
import * as ipcMethods from './mock-apis';
|
||||
|
||||
describe('tauri-ipc provider', async () => {
|
||||
const workspaceMetaCollection = new WorkspaceUnitCollection();
|
||||
const provider = new TauriIPCProvider({
|
||||
workspaces: workspaceMetaCollection.createScope(),
|
||||
messageCenter: new MessageCenter(),
|
||||
});
|
||||
provider.init(ipcMethods);
|
||||
|
||||
const workspaceName = 'workspace-test';
|
||||
let workspaceId: string | undefined;
|
||||
|
||||
test('create workspace', async () => {
|
||||
const workspaceUnit = await provider.createWorkspace({
|
||||
name: workspaceName,
|
||||
});
|
||||
workspaceId = workspaceUnit?.id;
|
||||
|
||||
expect(workspaceMetaCollection.workspaces.length).toEqual(1);
|
||||
expect(workspaceMetaCollection.workspaces[0].name).toEqual(workspaceName);
|
||||
});
|
||||
|
||||
test('workspace list', async () => {
|
||||
const workspacesMetaCollection1 = new WorkspaceUnitCollection();
|
||||
const provider1 = new TauriIPCProvider({
|
||||
workspaces: workspacesMetaCollection1.createScope(),
|
||||
messageCenter: new MessageCenter(),
|
||||
});
|
||||
provider1.init(ipcMethods);
|
||||
|
||||
await provider1.getUserInfo();
|
||||
await provider1.loadWorkspaces();
|
||||
expect(workspacesMetaCollection1.workspaces.length).toEqual(0);
|
||||
await provider1.createWorkspace({
|
||||
name: workspaceName,
|
||||
});
|
||||
expect(workspacesMetaCollection1.workspaces[0].name).toEqual(workspaceName);
|
||||
expect(workspacesMetaCollection1.workspaces[0].id).toEqual(workspaceId);
|
||||
});
|
||||
|
||||
test('update workspace', async () => {
|
||||
await provider.updateWorkspaceMeta(workspaceId!, {
|
||||
name: '1111',
|
||||
});
|
||||
expect(workspaceMetaCollection.workspaces[0].name).toEqual('1111');
|
||||
});
|
||||
});
|
2
packages/env/package.json
vendored
2
packages/env/package.json
vendored
@ -6,7 +6,7 @@
|
||||
"next": "=13.2.3",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"zod": "^3.21.3"
|
||||
"zod": "^3.21.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blocksuite/global": "0.5.0-20230320034723-8dfc65e",
|
||||
|
@ -17,7 +17,7 @@
|
||||
"scripts": {
|
||||
"build": "tsc --project ./tsconfig.json",
|
||||
"sync-languages": "NODE_OPTIONS=--experimental-fetch ts-node-esm src/scripts/sync.ts",
|
||||
"sync-languages:check": "pnpm run sync-languages --check",
|
||||
"sync-languages:check": "yarn run sync-languages --check",
|
||||
"download-resources": "NODE_OPTIONS=--experimental-fetch ts-node-esm src/scripts/download.ts"
|
||||
},
|
||||
"keywords": [],
|
||||
@ -35,7 +35,7 @@
|
||||
"@types/node": "^18.15.3",
|
||||
"@types/prettier": "^2.7.2",
|
||||
"next": "=13.2.3",
|
||||
"prettier": "^2.8.4",
|
||||
"prettier": "^2.8.5",
|
||||
"react-dom": "^18.2.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^5.0.2"
|
||||
|
@ -91,7 +91,7 @@ const main = async () => {
|
||||
|
||||
console.log('Generating meta data...');
|
||||
const code = `// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
// Run \`pnpm run download-resources\` to regenerate.
|
||||
// Run \`yarn run download-resources\` to regenerate.
|
||||
// To overwrite this, please overwrite download.ts script.
|
||||
${availableLanguages
|
||||
.map(
|
||||
|
File diff suppressed because one or more lines are too long
@ -56,7 +56,7 @@ const config: PlaywrightTestConfig = {
|
||||
},
|
||||
},
|
||||
{
|
||||
command: 'pnpm build && pnpm start -p 8080',
|
||||
command: 'yarn build && yarn start -p 8080',
|
||||
port: 8080,
|
||||
timeout: 120 * 1000,
|
||||
reuseExistingServer: !process.env.CI,
|
||||
|
14299
pnpm-lock.yaml
14299
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
@ -1,7 +0,0 @@
|
||||
packages:
|
||||
# apps folder for multiple platform clients
|
||||
- 'apps/*'
|
||||
- '!apps/electron'
|
||||
- '!apps/desktop'
|
||||
# all packages in direct subdirs of packages/
|
||||
- 'packages/*'
|
Loading…
Reference in New Issue
Block a user