markpdfdown 0.1.3-tone → 0.1.3-tthree

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 +23 -6
  2. package/package.json +2 -2
package/bin/cli.js CHANGED
@@ -14,6 +14,28 @@ const __filename = fileURLToPath(import.meta.url);
14
14
  const __dirname = dirname(__filename);
15
15
  const projectRoot = join(__dirname, '..');
16
16
 
17
+ // 确保 Electron 已安装
18
+ async function ensureElectron() {
19
+ const electronBin = process.platform === 'win32' ? 'electron.cmd' : 'electron';
20
+ const electronPath = join(projectRoot, 'node_modules', '.bin', electronBin);
21
+
22
+ if (!existsSync(electronPath)) {
23
+ console.log('📦 Electron not found. Installing...');
24
+ try {
25
+ execSync('npm install electron --no-save', {
26
+ cwd: projectRoot,
27
+ stdio: 'inherit',
28
+ shell: true
29
+ });
30
+ console.log('✅ Electron installed successfully.');
31
+ } catch (error) {
32
+ console.error('❌ Failed to install Electron:', error.message);
33
+ console.error(' Please try manually: npm install electron');
34
+ process.exit(1);
35
+ }
36
+ }
37
+ }
38
+
17
39
  // 确保 Prisma client 存在
18
40
  async function ensurePrismaClient() {
19
41
  const prismaClientPath = join(projectRoot, 'node_modules', '.prisma', 'client', 'index.js');
@@ -53,12 +75,6 @@ function launchElectron(args) {
53
75
  const electronPath = join(projectRoot, 'node_modules', '.bin', electronBin);
54
76
  const mainPath = join(projectRoot, 'dist', 'main', 'index.js');
55
77
 
56
- if (!existsSync(electronPath)) {
57
- console.error('❌ Electron not found at:', electronPath);
58
- console.error(' Please ensure dependencies are installed: npm install');
59
- process.exit(1);
60
- }
61
-
62
78
  if (!existsSync(mainPath)) {
63
79
  console.error('❌ Application not built. Main file not found at:', mainPath);
64
80
  console.error(' Please run: npm run build');
@@ -122,6 +138,7 @@ async function main() {
122
138
  switch (command) {
123
139
  case 'gui':
124
140
  case 'start':
141
+ await ensureElectron();
125
142
  await ensurePrismaClient();
126
143
  launchElectron(args.slice(1));
127
144
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markpdfdown",
3
- "version": "0.1.3-tone",
3
+ "version": "0.1.3-tthree",
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",
@@ -106,6 +106,7 @@
106
106
  "dependencies": {
107
107
  "@ant-design/icons": "^5.6.1",
108
108
  "@prisma/client": "^6.5.0",
109
+ "prisma": "^6.5.0",
109
110
  "@types/sharp": "^0.31.1",
110
111
  "antd": "^5.24.4",
111
112
  "electron-is-dev": "^3.0.1",
@@ -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",