Skip to content

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.

fix: runtime issue for electron app (#6306)

pengx171c9d89983197
diff --git a/packages/common/infra/package.json b/packages/common/infra/package.json
index 2a7432dda9..aedf824daf 100644
--- a/packages/common/infra/package.json
+++ b/packages/common/infra/package.json
@@ -3,6 +3,8 @@
"type": "module",
"private": true,
"exports": {
+ "./blocksuite": "./src/blocksuite/index.ts",
+ "./app-config-storage": "./src/app-config-storage.ts",
".": "./src/index.ts"
},
"dependencies": {
diff --git a/packages/frontend/electron/src/helper/db/base-db-adapter.ts b/packages/frontend/electron/src/helper/db/base-db-adapter.ts
index 4f7763d292..a9e0aa1573 100644
--- a/packages/frontend/electron/src/helper/db/base-db-adapter.ts
+++ b/packages/frontend/electron/src/helper/db/base-db-adapter.ts
@@ -1,6 +1,6 @@
import type { InsertRow } from '@affine/native';
import { SqliteConnection, ValidationResult } from '@affine/native';
-import { WorkspaceVersion } from '@toeverything/infra';
+import { WorkspaceVersion } from '@toeverything/infra/blocksuite';
import { applyGuidCompatibilityFix, migrateToLatest } from '../db/migration';
import { logger } from '../logger';
diff --git a/packages/frontend/electron/src/helper/db/migration.ts b/packages/frontend/electron/src/helper/db/migration.ts
index 110502611d..dc1da3519f 100644
--- a/packages/frontend/electron/src/helper/db/migration.ts
+++ b/packages/frontend/electron/src/helper/db/migration.ts
@@ -8,7 +8,7 @@ import {
migrateGuidCompatibility,
migrateToSubdoc,
WorkspaceVersion,
-} from '@toeverything/infra';
+} from '@toeverything/infra/blocksuite';
import fs from 'fs-extra';
import { nanoid } from 'nanoid';
import { applyUpdate, Doc as YDoc, encodeStateAsUpdate } from 'yjs';
diff --git a/packages/frontend/electron/src/helper/dialog/dialog.ts b/packages/frontend/electron/src/helper/dialog/dialog.ts
index 3ea7be1186..c532556d7b 100644
--- a/packages/frontend/electron/src/helper/dialog/dialog.ts
+++ b/packages/frontend/electron/src/helper/dialog/dialog.ts
@@ -1,7 +1,7 @@
import path from 'node:path';
import { ValidationResult } from '@affine/native';
-import { WorkspaceVersion } from '@toeverything/infra';
+import { WorkspaceVersion } from '@toeverything/infra/blocksuite';
import fs from 'fs-extra';
import { nanoid } from 'nanoid';
diff --git a/packages/frontend/electron/src/main/config-storage/persist.ts b/packages/frontend/electron/src/main/config-storage/persist.ts
index e1c1ab7a55..78fe9bfb5b 100644
--- a/packages/frontend/electron/src/main/config-storage/persist.ts
+++ b/packages/frontend/electron/src/main/config-storage/persist.ts
@@ -1,7 +1,10 @@
import fs from 'node:fs';
import path from 'node:path';
-import { AppConfigStorage, defaultAppConfig } from '@toeverything/infra';
+import {
+ AppConfigStorage,
+ defaultAppConfig,
+} from '@toeverything/infra/app-config-storage';
import { app } from 'electron';
const FILENAME = 'config.json';
diff --git a/packages/frontend/electron/tsconfig.json b/packages/frontend/electron/tsconfig.json
index 55a2d82b93..1a98e1e52b 100644
--- a/packages/frontend/electron/tsconfig.json
+++ b/packages/frontend/electron/tsconfig.json
@@ -11,7 +11,10 @@
"outDir": "lib",
"moduleResolution": "node",
"resolveJsonModule": true,
- "noImplicitOverride": true
+ "noImplicitOverride": true,
+ "paths": {
+ "@toeverything/infra/*": ["../../common/infra/src/*"]
+ }
},
"include": ["./src"],
"exclude": ["renderer", "node_modules", "lib", "dist", "**/__tests__/**/*"],