Skip to content

Commit 6b7c7b8

Browse files
committed
update
1 parent 69e9a78 commit 6b7c7b8

File tree

9 files changed

+26
-43
lines changed

9 files changed

+26
-43
lines changed

apps/desktop/README.md

+3-33
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,4 @@
1-
# electron-app
1+
构建路径:
22

3-
A minimal Electron application with TypeScript
4-
5-
## Recommended IDE Setup
6-
7-
- [VSCode](https://code.visualstudio.com/) + [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) + [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
8-
9-
## Project Setup
10-
11-
### Install
12-
13-
```bash
14-
$ pnpm install
15-
```
16-
17-
### Development
18-
19-
```bash
20-
$ pnpm dev
21-
```
22-
23-
### Build
24-
25-
```bash
26-
# For windows
27-
$ pnpm build:win
28-
29-
# For macOS
30-
$ pnpm build:mac
31-
32-
# For Linux
33-
$ pnpm build:linux
34-
```
3+
- dist: 构建产物路径
4+
- release: 发布产物路径

apps/desktop/electron-builder.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ appId: com.electron.app
22
productName: lobechat
33
directories:
44
buildResources: build
5+
output: 'release',
6+
57
files:
6-
- 'out'
8+
- 'dist'
79

810
asar: false
911
extraResources:

apps/desktop/electron.vite.config.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@ import { defineConfig, externalizeDepsPlugin } from 'electron-vite';
22

33
export default defineConfig({
44
main: {
5+
build: {
6+
outDir: 'dist/main',
7+
},
58
plugins: [externalizeDepsPlugin({})],
69
},
710
preload: {
8-
build: {},
11+
build: {
12+
outDir: 'dist/preload',
13+
},
914
plugins: [externalizeDepsPlugin({})],
1015
},
1116
});

apps/desktop/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "A minimal Electron application with TypeScript",
55
"homepage": "https://electron-vite.org",
66
"author": "example.com",
7-
"main": "./out/main/index.js",
7+
"main": "./dist/main/index.js",
88
"scripts": {
99
"build": "npm run typecheck && electron-vite build",
1010
"build:linux": "npm run build && electron-builder --linux",

apps/desktop/src/main/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let mainWindow;
1010
let stopIntercept;
1111

1212
// Next.js handler
13-
const standaloneDir = path.join(appPath, 'out', 'standalone');
13+
const standaloneDir = path.join(appPath, 'dist', 'next');
1414
const { createInterceptor } = createHandler({
1515
debug: true,
1616
localhostUrl,

next.config.ts

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const isStandaloneMode = buildWithDocker || isDesktop;
1818
const nextConfig: NextConfig = {
1919
basePath,
2020
compress: isProd,
21+
// 桌面端模式下,将输出路径改为桌面端目录下面
22+
distDir: isDesktop && isProd ? 'apps/desktop/dist/next' : undefined,
2123
experimental: {
2224
optimizePackageImports: [
2325
'emoji-mart',

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"build-sitemap": "tsx ./scripts/buildSitemapIndex/index.ts",
3636
"build:analyze": "ANALYZE=true next build",
3737
"build:docker": "DOCKER=true next build && npm run build-sitemap",
38+
"build:electron": "next build",
3839
"db:generate": "drizzle-kit generate && npm run db:generate-client && npm run workflow:dbml",
3940
"db:generate-client": "tsx ./scripts/migrateClientDB/compile-migrations.ts",
4041
"db:migrate": "MIGRATION_DB=1 tsx ./scripts/migrateServerDB/index.ts",

src/database/server/core/db.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import * as schema from '../../schemas';
1313

1414
export const getPgliteInstance = () => {
1515
const client = new PGlite('lobechat-db');
16-
return pgliteDrizzle({ client, schema });
16+
17+
return pgliteDrizzle({ client, schema }) as unknown as NeonDatabase<typeof schema>;
1718
};
1819

1920
export const getDBInstance = (): NeonDatabase<typeof schema> => {

tsconfig.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,16 @@
2929
},
3030
"exclude": ["node_modules", "public/sw.js", "apps/desktop"],
3131
"include": [
32+
"**/*.d.ts",
33+
"**/*.ts",
34+
"**/*.tsx",
35+
".next-desktop/types/**/*.ts",
36+
".next/types/**/*.ts",
3237
"next-env.d.ts",
33-
"vitest.config.ts",
3438
"src",
3539
"tests",
36-
"**/*.ts",
37-
"**/*.d.ts",
38-
"**/*.tsx",
39-
".next/types/**/*.ts"
40+
"vitest.config.ts",
41+
"apps/desktop/out/types/**/*.ts"
4042
],
4143
"ts-node": {
4244
"compilerOptions": {

0 commit comments

Comments
 (0)