markpdfdown 0.1.3-t01 → 0.1.3-tfive

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/cli.js +17 -5
  2. package/package.json +4 -4
package/bin/cli.js CHANGED
@@ -21,12 +21,12 @@ async function ensurePrismaClient() {
21
21
  if (!existsSync(prismaClientPath)) {
22
22
  console.log('🔧 Prisma client not found. Generating...');
23
23
  try {
24
- // 使用项目本地的 prisma CLI,避免使用用户系统上可能不兼容的全局版本
24
+ // 使用项目本地的 prisma CLI
25
25
  const prismaBin = process.platform === 'win32' ? 'prisma.cmd' : 'prisma';
26
26
  const prismaPath = join(projectRoot, 'node_modules', '.bin', prismaBin);
27
27
  const prismaCmd = existsSync(prismaPath)
28
28
  ? `"${prismaPath}"`
29
- : 'npx prisma'; // 回退到 npx
29
+ : 'npx prisma';
30
30
 
31
31
  // 设置临时的 DATABASE_URL,prisma generate 需要此变量存在
32
32
  // 实际的数据库路径在运行时由 db/index.ts 动态决定
@@ -47,14 +47,26 @@ async function ensurePrismaClient() {
47
47
  }
48
48
  }
49
49
 
50
+ // 获取 Electron 可执行文件路径
51
+ function getElectronPath() {
52
+ const require = createRequire(import.meta.url);
53
+ try {
54
+ // 使用 electron 包导出的路径(最可靠的方式)
55
+ return require('electron');
56
+ } catch (e) {
57
+ console.error('❌ Electron not found. Please ensure the package is installed correctly.');
58
+ process.exit(1);
59
+ }
60
+ }
61
+
50
62
  // 启动 Electron
51
63
  function launchElectron(args) {
52
- const electronBin = process.platform === 'win32' ? 'electron.cmd' : 'electron';
53
- const electronPath = join(projectRoot, 'node_modules', '.bin', electronBin);
64
+ const electronPath = getElectronPath();
54
65
  const mainPath = join(projectRoot, 'dist', 'main', 'index.js');
55
66
 
56
67
  if (!existsSync(mainPath)) {
57
- console.error('❌ Application not built. Please run: npm run build');
68
+ console.error('❌ Application not built. Main file not found at:', mainPath);
69
+ console.error(' Please run: npm run build');
58
70
  process.exit(1);
59
71
  }
60
72
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "markpdfdown",
3
- "version": "0.1.3-t01",
3
+ "version": "0.1.3-tfive",
4
4
  "description": "A high-quality PDF to Markdown tool based on large language model visual recognition.",
5
5
  "author": "MarkPDFdown",
6
6
  "main": "dist/main/index.js",
7
7
  "bin": {
8
- "markpdfdown": "./bin/cli.js"
8
+ "markpdfdown": "bin/cli.js"
9
9
  },
10
10
  "type": "module",
11
11
  "engines": {
@@ -106,6 +106,8 @@
106
106
  "dependencies": {
107
107
  "@ant-design/icons": "^5.6.1",
108
108
  "@prisma/client": "^6.5.0",
109
+ "prisma": "^6.5.0",
110
+ "electron": "^35.0.2",
109
111
  "@types/sharp": "^0.31.1",
110
112
  "antd": "^5.24.4",
111
113
  "electron-is-dev": "^3.0.1",
@@ -135,7 +137,6 @@
135
137
  "@vitejs/plugin-react": "^4.3.4",
136
138
  "@vitest/coverage-v8": "^2.1.8",
137
139
  "concurrently": "^9.1.2",
138
- "electron": "^35.0.2",
139
140
  "electron-builder": "^25.1.8",
140
141
  "electron-icon-builder": "^2.0.1",
141
142
  "electron-vite": "^3.1.0",
@@ -146,7 +147,6 @@
146
147
  "husky": "^9.1.7",
147
148
  "jsdom": "^25.0.1",
148
149
  "nodemon": "^3.1.9",
149
- "prisma": "^6.5.0",
150
150
  "typescript": "~5.7.2",
151
151
  "typescript-eslint": "^8.24.1",
152
152
  "vite": "^6.2.0",