ci: add prettier format check (#2908)

This commit is contained in:
Alex Yang
2023-06-29 12:13:35 +08:00
parent bf30185c65
commit d98586773c
9 changed files with 78 additions and 60 deletions

View File

@@ -65,6 +65,7 @@ const config = {
'plugin:react/recommended', 'plugin:react/recommended',
'plugin:react/jsx-runtime', 'plugin:react/jsx-runtime',
'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended',
'prettier',
], ],
parser: '@typescript-eslint/parser', parser: '@typescript-eslint/parser',
parserOptions: { parserOptions: {

View File

@@ -1,51 +1,58 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: "{{ include "affine-cloud.fullname" . }}" name: { { include "affine-cloud.fullname" . } }
labels: labels: { { - include "affine-cloud.labels" . | nindent 4 } }
{{- include "affine-cloud.labels" . | nindent 4 }}
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels: { { - include "affine-cloud.selectorLabels" . | nindent 6 } }
{{- include "affine-cloud.selectorLabels" . | nindent 6 }}
strategy: strategy:
type: RollingUpdate type: RollingUpdate
rollingUpdate: rollingUpdate:
maxUnavailable: 2 maxUnavailable: 2
template: template:
metadata: metadata:
labels: labels: { { - include "affine-cloud.selectorLabels" . | nindent 8 } }
{{- include "affine-cloud.selectorLabels" . | nindent 8 }}
spec: spec:
restartPolicy: Always restartPolicy: Always
containers: containers:
- name: affine-cloud - name: affine-cloud
image: "ghcr.io/toeverything/cloud-self-hosted:{{ .Values.affineCloud.tag | default .Chart.AppVersion }}" image: 'ghcr.io/toeverything/cloud-self-hosted:{{ .Values.affineCloud.tag | default .Chart.AppVersion }}'
env: env:
- name: PG_USER - name: PG_USER
value: "{{ .Values.postgresql.auth.username }}" value: { { .Values.postgresql.auth.username } }
- name: PG_PASS - name: PG_PASS
value: "{{ .Values.postgresql.auth.password }}" value: { { .Values.postgresql.auth.password } }
- name: PG_DATABASE - name: PG_DATABASE
value: "{{ .Values.postgresql.auth.database }}" value: { { .Values.postgresql.auth.database } }
- name: PG_HOST - name: PG_HOST
value: "{{ .Values.postgresql.fullnameOverride | default (printf "%s-postgresql" .Release.Name) }}" value:
- name: DATABASE_URL {
value: "{{ .Values.affineCloud.databaseUrl | default "postgresql://$(PG_USER):$(PG_PASS)@$(PG_HOST)/$(PG_DATABASE)" }}" {
envFrom: .Values.postgresql.fullnameOverride | default (printf "%s-postgresql" .Release.Name),
- secretRef: },
name: affine-cloud-secret }
ports: - name: DATABASE_URL
- containerPort: 3000 value:
livenessProbe: {
httpGet: {
path: /api/healthz .Values.affineCloud.databaseUrl | default "postgresql://$(PG_USER):$(PG_PASS)@$(PG_HOST)/$(PG_DATABASE)",
port: 3000 },
failureThreshold: 1 }
initialDelaySeconds: 10 envFrom:
periodSeconds: 10 - secretRef:
resources: name: affine-cloud-secret
limits: ports:
cpu: "{{ .Values.affineCloud.resources.cpu }}" - containerPort: 3000
memory: "{{ .Values.affineCloud.resources.memory }}" 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 }}'

View File

@@ -4,6 +4,6 @@ metadata:
name: affine-cloud-secret name: affine-cloud-secret
type: Opaque type: Opaque
data: data:
SIGN_KEY: "{{ .Values.affineCloud.signKey }}" SIGN_KEY: '{{ .Values.affineCloud.signKey }}'
MAIL_ACCOUNT: "{{ .Values.affineCloud.mail.account }}" MAIL_ACCOUNT: '{{ .Values.affineCloud.mail.account }}'
MAIL_PASSWORD: "{{ .Values.affineCloud.mail.password }}" MAIL_PASSWORD: '{{ .Values.affineCloud.mail.password }}'

View File

@@ -1,15 +1,13 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: "{{ include "affine-cloud.fullname" . }}" name: { { include "affine-cloud.fullname" . } }
labels: labels: { { - include "affine-cloud.labels" . | nindent 4 } }
{{- include "affine-cloud.labels" . | nindent 4 }}
spec: spec:
type: "{{ .Values.affineCloud.service.type }}" type: '{{ .Values.affineCloud.service.type }}'
ports: ports:
- name: http - name: http
protocol: TCP protocol: TCP
port: {{ .Values.affineCloud.service.port }} port: { { .Values.affineCloud.service.port } }
targetPort: 3000 targetPort: 3000
selector: selector: { { - include "affine-cloud.selectorLabels" . | nindent 4 } }
{{- include "affine-cloud.selectorLabels" . | nindent 4 }}

View File

@@ -42,12 +42,16 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Setup Node.js - name: Setup Node.js
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
- name: Run checks - name: Run i18n codegen
run: | run: yarn i18n-codegen gen
yarn i18n-codegen gen - name: Run Type Check
yarn typecheck run: yarn typecheck
yarn lint --max-warnings=0 - name: Run ESLint
yarn circular 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: build-docs:
name: Build Docs name: Build Docs

View File

@@ -1,5 +1,11 @@
pnpm-lock.yaml yarn.lock
target target
lib lib
test-results test-results
packages/i18n/src/i18n-generated.ts
packages/graphql/src/graphql/index.ts packages/graphql/src/graphql/index.ts
.next
out
dist
.yarn
tests/affine-legacy/0.7.0-canary.18/static

View File

@@ -1,6 +1,4 @@
import { import { SettingRow } from '@affine/component/setting-components';
SettingRow,
} from '@affine/component/setting-components';
import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { useAFFiNEI18N } from '@affine/i18n/hooks';
import { ArrowRightSmallIcon } from '@blocksuite/icons'; import { ArrowRightSmallIcon } from '@blocksuite/icons';
import { type FC, useState } from 'react'; import { type FC, useState } from 'react';

View File

@@ -63,13 +63,14 @@ Note: use `strip` from system instead of `binutils` if you are runinng MacOS. [s
yarn workspace @affine/native build 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 You need to run two scripts to run the app in development mode
Firstly, run the web app which is served at :8080 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 Secondly, bring up the electron app

View File

@@ -8,8 +8,11 @@ import { test as baseTest } from '@playwright/test';
export const rootDir = resolve(__dirname, '..', '..'); export const rootDir = resolve(__dirname, '..', '..');
// assert that the rootDir is the root of the project // assert that the rootDir is the root of the project
// eslint-disable-next-line @typescript-eslint/no-var-requires ok(
ok(require(resolve(rootDir, 'package.json')).name.toLowerCase() === '@affine/monorepo'); // 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'); export const testResultDir = resolve(rootDir, 'test-results');