diff --git a/.eslintrc.js b/.eslintrc.js index 2a7f180803..0d9eb8072b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -65,6 +65,7 @@ const config = { 'plugin:react/recommended', 'plugin:react/jsx-runtime', 'plugin:@typescript-eslint/recommended', + 'prettier', ], parser: '@typescript-eslint/parser', parserOptions: { diff --git a/.github/helm/affine-cloud/templates/deployment.yaml b/.github/helm/affine-cloud/templates/deployment.yaml index c8d8d6fbe7..14319e8011 100644 --- a/.github/helm/affine-cloud/templates/deployment.yaml +++ b/.github/helm/affine-cloud/templates/deployment.yaml @@ -1,51 +1,58 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: "{{ include "affine-cloud.fullname" . }}" - labels: - {{- include "affine-cloud.labels" . | nindent 4 }} + name: { { include "affine-cloud.fullname" . } } + labels: { { - include "affine-cloud.labels" . | nindent 4 } } spec: replicas: 1 selector: - matchLabels: - {{- include "affine-cloud.selectorLabels" . | nindent 6 }} + matchLabels: { { - include "affine-cloud.selectorLabels" . | nindent 6 } } strategy: type: RollingUpdate rollingUpdate: maxUnavailable: 2 template: metadata: - labels: - {{- include "affine-cloud.selectorLabels" . | nindent 8 }} + labels: { { - include "affine-cloud.selectorLabels" . | nindent 8 } } spec: restartPolicy: Always containers: - - name: affine-cloud - image: "ghcr.io/toeverything/cloud-self-hosted:{{ .Values.affineCloud.tag | default .Chart.AppVersion }}" - env: - - name: PG_USER - value: "{{ .Values.postgresql.auth.username }}" - - name: PG_PASS - value: "{{ .Values.postgresql.auth.password }}" - - name: PG_DATABASE - value: "{{ .Values.postgresql.auth.database }}" - - name: PG_HOST - value: "{{ .Values.postgresql.fullnameOverride | default (printf "%s-postgresql" .Release.Name) }}" - - name: DATABASE_URL - value: "{{ .Values.affineCloud.databaseUrl | default "postgresql://$(PG_USER):$(PG_PASS)@$(PG_HOST)/$(PG_DATABASE)" }}" - envFrom: - - secretRef: - name: affine-cloud-secret - ports: - - containerPort: 3000 - livenessProbe: - httpGet: - path: /api/healthz - port: 3000 - failureThreshold: 1 - initialDelaySeconds: 10 - periodSeconds: 10 - resources: - limits: - cpu: "{{ .Values.affineCloud.resources.cpu }}" - memory: "{{ .Values.affineCloud.resources.memory }}" + - name: affine-cloud + image: 'ghcr.io/toeverything/cloud-self-hosted:{{ .Values.affineCloud.tag | default .Chart.AppVersion }}' + env: + - name: PG_USER + value: { { .Values.postgresql.auth.username } } + - name: PG_PASS + value: { { .Values.postgresql.auth.password } } + - name: PG_DATABASE + value: { { .Values.postgresql.auth.database } } + - name: PG_HOST + value: + { + { + .Values.postgresql.fullnameOverride | default (printf "%s-postgresql" .Release.Name), + }, + } + - name: DATABASE_URL + value: + { + { + .Values.affineCloud.databaseUrl | default "postgresql://$(PG_USER):$(PG_PASS)@$(PG_HOST)/$(PG_DATABASE)", + }, + } + envFrom: + - secretRef: + name: affine-cloud-secret + ports: + - containerPort: 3000 + livenessProbe: + httpGet: + path: /api/healthz + port: 3000 + failureThreshold: 1 + initialDelaySeconds: 10 + periodSeconds: 10 + resources: + limits: + cpu: '{{ .Values.affineCloud.resources.cpu }}' + memory: '{{ .Values.affineCloud.resources.memory }}' diff --git a/.github/helm/affine-cloud/templates/secret.yaml b/.github/helm/affine-cloud/templates/secret.yaml index f6879af5e8..22106c2a3f 100644 --- a/.github/helm/affine-cloud/templates/secret.yaml +++ b/.github/helm/affine-cloud/templates/secret.yaml @@ -4,6 +4,6 @@ metadata: name: affine-cloud-secret type: Opaque data: - SIGN_KEY: "{{ .Values.affineCloud.signKey }}" - MAIL_ACCOUNT: "{{ .Values.affineCloud.mail.account }}" - MAIL_PASSWORD: "{{ .Values.affineCloud.mail.password }}" + SIGN_KEY: '{{ .Values.affineCloud.signKey }}' + MAIL_ACCOUNT: '{{ .Values.affineCloud.mail.account }}' + MAIL_PASSWORD: '{{ .Values.affineCloud.mail.password }}' diff --git a/.github/helm/affine-cloud/templates/services.yaml b/.github/helm/affine-cloud/templates/services.yaml index 2529d4569d..c63da63c73 100644 --- a/.github/helm/affine-cloud/templates/services.yaml +++ b/.github/helm/affine-cloud/templates/services.yaml @@ -1,15 +1,13 @@ apiVersion: v1 kind: Service metadata: - name: "{{ include "affine-cloud.fullname" . }}" - labels: - {{- include "affine-cloud.labels" . | nindent 4 }} + name: { { include "affine-cloud.fullname" . } } + labels: { { - include "affine-cloud.labels" . | nindent 4 } } spec: - type: "{{ .Values.affineCloud.service.type }}" + type: '{{ .Values.affineCloud.service.type }}' ports: - name: http protocol: TCP - port: {{ .Values.affineCloud.service.port }} + port: { { .Values.affineCloud.service.port } } targetPort: 3000 - selector: - {{- include "affine-cloud.selectorLabels" . | nindent 4 }} + selector: { { - include "affine-cloud.selectorLabels" . | nindent 4 } } diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4143078595..cb4919409f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,12 +42,16 @@ jobs: - uses: actions/checkout@v3 - name: Setup Node.js uses: ./.github/actions/setup-node - - name: Run checks - run: | - yarn i18n-codegen gen - yarn typecheck - yarn lint --max-warnings=0 - yarn circular + - name: Run i18n codegen + run: yarn i18n-codegen gen + - name: Run Type Check + run: yarn typecheck + - name: Run ESLint + run: yarn lint --max-warnings=0 --cache + - name: Run Prettier + run: yarn prettier . --ignore-unknown --cache --check + - name: Run circular + run: yarn circular build-docs: name: Build Docs diff --git a/.prettierignore b/.prettierignore index be1e4f755b..a4f73c2e47 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,11 @@ -pnpm-lock.yaml +yarn.lock target lib test-results +packages/i18n/src/i18n-generated.ts packages/graphql/src/graphql/index.ts +.next +out +dist +.yarn +tests/affine-legacy/0.7.0-canary.18/static diff --git a/apps/web/src/components/affine/new-workspace-setting-detail/delete-leave-workspace/index.tsx b/apps/web/src/components/affine/new-workspace-setting-detail/delete-leave-workspace/index.tsx index 40d133ccbd..9117d6e877 100644 --- a/apps/web/src/components/affine/new-workspace-setting-detail/delete-leave-workspace/index.tsx +++ b/apps/web/src/components/affine/new-workspace-setting-detail/delete-leave-workspace/index.tsx @@ -1,6 +1,4 @@ -import { - SettingRow, -} from '@affine/component/setting-components'; +import { SettingRow } from '@affine/component/setting-components'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { ArrowRightSmallIcon } from '@blocksuite/icons'; import { type FC, useState } from 'react'; diff --git a/docs/BUILDING.md b/docs/BUILDING.md index cd3c161d59..d161ff59fb 100644 --- a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -63,13 +63,14 @@ Note: use `strip` from system instead of `binutils` if you are runinng MacOS. [s yarn workspace @affine/native build ``` -## Debugging the Electron App +## Debugging the Electron App You need to run two scripts to run the app in development mode Firstly, run the web app which is served at :8080 + ``` -yarn dev # you may want to chose `dev - 100.84.105.99:11001` when selecting the dev server +yarn dev # you may want to chose `dev - 100.84.105.99:11001` when selecting the dev server ``` Secondly, bring up the electron app diff --git a/tests/kit/playwright.ts b/tests/kit/playwright.ts index d8aef99d59..286b73af06 100644 --- a/tests/kit/playwright.ts +++ b/tests/kit/playwright.ts @@ -8,8 +8,11 @@ import { test as baseTest } from '@playwright/test'; export const rootDir = resolve(__dirname, '..', '..'); // assert that the rootDir is the root of the project -// eslint-disable-next-line @typescript-eslint/no-var-requires -ok(require(resolve(rootDir, 'package.json')).name.toLowerCase() === '@affine/monorepo'); +ok( + // eslint-disable-next-line @typescript-eslint/no-var-requires + require(resolve(rootDir, 'package.json')).name.toLowerCase() === + '@affine/monorepo' +); export const testResultDir = resolve(rootDir, 'test-results');