markpdfdown 0.1.2 → 0.1.3

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/dist/main/index.js +15 -1
  2. package/package.json +1 -1
@@ -11,6 +11,7 @@ import { PDFDocument } from "pdf-lib";
11
11
  import sharp from "sharp";
12
12
  import fs$1 from "fs/promises";
13
13
  import { v4 } from "uuid";
14
+ import { createRequire } from "module";
14
15
  import __cjs_mod__ from "node:module";
15
16
  const __filename = import.meta.filename;
16
17
  const __dirname = import.meta.dirname;
@@ -3297,9 +3298,22 @@ function registerCompletionHandlers() {
3297
3298
  );
3298
3299
  console.log("[IPC] Completion handlers registered");
3299
3300
  }
3301
+ const requireJson = createRequire(import.meta.url);
3302
+ function getAppVersion() {
3303
+ if (app.isPackaged) {
3304
+ return app.getVersion();
3305
+ }
3306
+ try {
3307
+ const packageJsonPath = path.join(process.cwd(), "package.json");
3308
+ const packageJson = requireJson(packageJsonPath);
3309
+ return packageJson.version || "0.0.0";
3310
+ } catch {
3311
+ return app.getVersion();
3312
+ }
3313
+ }
3300
3314
  function registerAppHandlers() {
3301
3315
  ipcMain.handle("app:getVersion", () => {
3302
- return app.getVersion();
3316
+ return getAppVersion();
3303
3317
  });
3304
3318
  }
3305
3319
  function registerAllHandlers() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markpdfdown",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
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",