zidane-gui 7.0.2 → 7.0.7

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zidane-gui",
3
3
  "productName": "Zidane",
4
- "version": "7.0.2",
4
+ "version": "7.0.7",
5
5
  "description": "Zidane Desktop",
6
6
  "author": "StackBlitz",
7
7
  "type": "module",
@@ -59,7 +59,7 @@
59
59
  "shiki": "^4.1.0",
60
60
  "electron": "^41.7.0",
61
61
  "tippy.js": "^6.3.7",
62
- "zidane": "7.0.2",
62
+ "zidane": "7.0.7",
63
63
  "zod": "^4.4.3"
64
64
  },
65
65
  "devDependencies": {
@@ -47,6 +47,27 @@ export function packageDir() {
47
47
  return dirname(import.meta.dirname);
48
48
  }
49
49
 
50
+ /**
51
+ * Where the package will live once the install FINISHES — which is not
52
+ * always where postinstall runs.
53
+ *
54
+ * Volta stages global installs in `$VOLTA_HOME/tmp/image/packages/.tmpXXXX/
55
+ * lib/node_modules/<name>`, runs lifecycle scripts there, then moves the
56
+ * tree to `$VOLTA_HOME/tools/image/packages/<name>/lib/node_modules/<name>`.
57
+ * A symlink recorded against the staging path dangles the moment the move
58
+ * happens, and Electron — finding no app at `Resources/app` — shows its
59
+ * default "To run a local app…" window instead of Zidane. Map the staging
60
+ * path to the final one; every other package manager installs in place, so
61
+ * the directory is returned unchanged.
62
+ */
63
+ export function finalPackageDir(pkgDir = packageDir()) {
64
+ const match =
65
+ /^(.*[\\/]\.volta)[\\/]tmp[\\/]image[\\/]packages[\\/][^\\/]+[\\/]lib[\\/]node_modules[\\/]([^\\/]+)$/.exec(pkgDir);
66
+ if (!match) return pkgDir;
67
+ const [, voltaHome, name] = match;
68
+ return join(voltaHome, 'tools', 'image', 'packages', name, 'lib', 'node_modules', name);
69
+ }
70
+
50
71
  /**
51
72
  * Locate the `electron` dependency's install as seen from the package:
52
73
  * `{ dist, binary }` where `binary` is the absolute path to the launchable
@@ -164,10 +185,12 @@ function installMacApp(pkgDir, electron) {
164
185
  }
165
186
 
166
187
  // Electron loads Contents/Resources/app as the application; symlinking it
167
- // to the npm package keeps the .app current across `npm update -g`.
188
+ // to the npm package keeps the .app current across `npm update -g`. The
189
+ // target is where the package ENDS UP (see `finalPackageDir`), not where
190
+ // this script happens to be running from.
168
191
  const appLink = join(resources, 'app');
169
192
  rmSync(appLink, { recursive: true, force: true });
170
- symlinkSync(pkgDir, appLink, 'dir');
193
+ symlinkSync(finalPackageDir(pkgDir), appLink, 'dir');
171
194
 
172
195
  // Plist edits break the ad-hoc bundle seal; re-sign ad-hoc so Apple
173
196
  // Silicon's launch-time signature check stays happy. Best-effort — the
@@ -187,7 +210,13 @@ function installLinuxApp(pkgDir, electron) {
187
210
  mkdirSync(dirname(desktopPath), { recursive: true });
188
211
  mkdirSync(dirname(iconPath), { recursive: true });
189
212
  cpSync(join(pkgDir, 'resources/icon.png'), iconPath);
190
- writeFileSync(desktopPath, buildDesktopEntry({ electronBinary: electron.binary, appDir: pkgDir }));
213
+ // Both paths must point at the package's FINAL location (see
214
+ // `finalPackageDir`): the electron binary lives inside its node_modules.
215
+ const appDir = finalPackageDir(pkgDir);
216
+ const electronBinary = electron.binary.startsWith(pkgDir)
217
+ ? appDir + electron.binary.slice(pkgDir.length)
218
+ : electron.binary;
219
+ writeFileSync(desktopPath, buildDesktopEntry({ electronBinary, appDir }));
191
220
  tryRun('update-desktop-database', [dirname(desktopPath)]);
192
221
  return desktopPath;
193
222
  }