There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
refactor: cleanup code
Alex Yangd9e2d17a269c
diff --git a/.github/workflows/build-desktop.yml b/.github/workflows/build-desktop.ymlindex d9d58d7ee9..757bd22865 100644--- a/.github/workflows/build-desktop.yml+++ b/.github/workflows/build-desktop.yml@@ -166,7 +166,7 @@ jobs:- name: Output checkif: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }}run: |- yarn workspace @affine/electron ts-node-esm ./scripts/macos-arm64-output-check.mts+ yarn workspace @affine/electron ts-node ./scripts/macos-arm64-output-check.ts- name: Collect code coverage reportif: ${{ matrix.spec.test }}diff --git a/.github/workflows/build-server.yml b/.github/workflows/build-server.ymlindex e1e51f8db3..9d84621825 100644--- a/.github/workflows/build-server.yml+++ b/.github/workflows/build-server.yml@@ -109,7 +109,7 @@ jobs:DATABASE_URL: postgresql://affine:affine@localhost:5432/affine- name: Run init-db script- run: yarn workspace @affine/server exec ts-node-esm ./scripts/init-db.ts+ run: yarn workspace @affine/server exec ts-node ./scripts/init-db.tsenv:DATABASE_URL: postgresql://affine:affine@localhost:5432/affine@@ -180,7 +180,7 @@ jobs:DATABASE_URL: postgresql://affine:affine@localhost:5432/affine- name: Run init-db script- run: yarn workspace @affine/server exec ts-node-esm ./scripts/init-db.ts+ run: yarn workspace @affine/server exec ts-node ./scripts/init-db.tsenv:DATABASE_URL: postgresql://affine:affine@localhost:5432/affine@@ -270,7 +270,7 @@ jobs:DATABASE_URL: postgresql://affine:affine@localhost:5432/affine- name: Run init-db script- run: yarn workspace @affine/server exec ts-node-esm ./scripts/init-db.ts+ run: yarn workspace @affine/server exec ts-node ./scripts/init-db.tsenv:DATABASE_URL: postgresql://affine:affine@localhost:5432/affinediff --git a/packages/common/y-indexeddb/benchmark/README.md b/packages/common/y-indexeddb/benchmark/README.mddeleted file mode 100644index a3e1419ef4..0000000000--- a/packages/common/y-indexeddb/benchmark/README.md+++ /dev/null@@ -1 +0,0 @@-This benchmark is outdated because our new API for IndexedDB has no direct parity with the official provider.diff --git a/packages/common/y-indexeddb/benchmark/index.ts b/packages/common/y-indexeddb/benchmark/index.tsdeleted file mode 100755index ab17319c25..0000000000--- a/packages/common/y-indexeddb/benchmark/index.ts+++ /dev/null@@ -1,113 +0,0 @@-#!/usr/bin/env ts-node-esm-import 'fake-indexeddb/auto';--const map = new Map();-const localStorage = {- getItem: (key: string) => map.get(key),- setItem: (key: string, value: string) => map.set(key, value),- clear: () => map.clear(),-};--// @ts-expect-error-globalThis.localStorage = localStorage;--import { Workspace } from '@blocksuite/store';-import { IndexeddbPersistence } from 'y-indexeddb';--const Y = Workspace.Y;--// eslint-disable-next-line @typescript-eslint/no-restricted-imports-import { createIndexedDBProvider } from '../dist/index.js';--// @ts-expect-error-globalThis.window = {- addEventListener: () => void 0,- removeEventListener: () => void 0,-};--async function yjs_create_persistence(n = 1e3) {- for (let i = 0; i < n; i++) {- const yDoc = new Y.Doc();- const persistence = new IndexeddbPersistence('test', yDoc);- await persistence.whenSynced;- persistence.destroy();- }-}--async function yjs_single_persistence(n = 1e5) {- const yDoc = new Y.Doc();- const map = yDoc.getMap();- for (let i = 0; i < n; i++) {- map.set(`${i}`, i);- }- {- const persistence = new IndexeddbPersistence('test', yDoc);- await persistence.whenSynced;- persistence.destroy();- }- {- const persistence = new IndexeddbPersistence('test', yDoc);- await persistence.whenSynced;- persistence.destroy();- }-}--async function toeverything_create_provider(n = 1e3) {- for (let i = 0; i < n; i++) {- const yDoc = new Y.Doc({- guid: 'test',- });- const provider = createIndexedDBProvider(yDoc);- provider.connect();- await provider.whenSynced;- provider.disconnect();- }-}-async function toeverything_single_persistence(n = 1e5) {- const yDoc = new Y.Doc({- guid: 'test',- });- const map = yDoc.getMap();- for (let i = 0; i < n; i++) {- map.set(`${i}`, i);- }- const provider = createIndexedDBProvider(yDoc, 'test');- provider.connect();- await provider.whenSynced;- provider.disconnect();- provider.connect();- await provider.whenSynced;- provider.disconnect();-}--async function main() {- console.log('create many persistence');- performance.mark('start');- await yjs_create_persistence();- performance.mark('end');- performance.measure('yjs', 'start', 'end');- indexedDB.deleteDatabase('test');- performance.mark('start');- await toeverything_create_provider();- performance.mark('end');- performance.measure('toeverything', 'start', 'end');- console.log(performance.getEntriesByType('measure'));- indexedDB.deleteDatabase('test');- performance.clearMarks();- performance.clearMeasures();- localStorage.clear();-- console.log('single persistence with huge updates');- performance.mark('start');- await yjs_single_persistence();- performance.mark('end');- performance.measure('yjs', 'start', 'end');- indexedDB.deleteDatabase('test');- performance.mark('start');- await toeverything_single_persistence();- performance.mark('end');- performance.measure('toeverything', 'start', 'end');- console.log(performance.getEntriesByType('measure'));-}--main().then();diff --git a/packages/frontend/electron/scripts/macos-arm64-output-check.mts b/packages/frontend/electron/scripts/macos-arm64-output-check.tssimilarity index 100%rename from packages/frontend/electron/scripts/macos-arm64-output-check.mtsrename to packages/frontend/electron/scripts/macos-arm64-output-check.tsdiff --git a/packages/frontend/i18n/package.json b/packages/frontend/i18n/package.jsonindex 3750e06652..bff33c7fa6 100644--- a/packages/frontend/i18n/package.json+++ b/packages/frontend/i18n/package.json@@ -17,9 +17,9 @@"scripts": {"build": "node build.mjs","dev": "node dev.mjs",- "sync-languages": "ts-node-esm -P ./tsconfig.node.json src/scripts/sync.ts",+ "sync-languages": "ts-node -P ./tsconfig.node.json src/scripts/sync.ts","sync-languages:check": "yarn run sync-languages --check",- "download-resources": "ts-node-esm -P ./tsconfig.node.json src/scripts/download.ts"+ "download-resources": "ts-node -P ./tsconfig.node.json src/scripts/download.ts"},"keywords": [],"repository": {diff --git a/tsconfig.json b/tsconfig.jsonindex f9f213b038..f5fe164de3 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -198,6 +198,7 @@"files": [],"exclude": ["node_modules", "target", "lib", "test-results"],"ts-node": {+ "esm": true,"compilerOptions": {"module": "ESNext","moduleResolution": "Node"