Skip to content

Commit

Permalink
fix: runtime issue for electron app (#6306)
Browse files Browse the repository at this point in the history
Looks like we need to be careful to share common libraries between electron (nodejs) & web

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/T2klNLEk0wxLh4NRDzhk/7e568e47-2d61-45c8-8a1e-b933b63fd1a9.png)
  • Loading branch information
pengx17 committed Mar 26, 2024
1 parent 00092c9 commit 1c9d899
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions packages/common/infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/electron/src/helper/db/migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/electron/src/helper/dialog/dialog.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
5 changes: 4 additions & 1 deletion packages/frontend/electron/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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__/**/*"],
Expand Down

0 comments on commit 1c9d899

Please sign in to comment.