@telepath-computer/television-desktop 0.1.107 → 0.1.112

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/README.md CHANGED
@@ -19,11 +19,8 @@ token, or a `--public` server with an empty token).
19
19
 
20
20
  ## macOS notes
21
21
 
22
- The first install runs a postinstall script that renames the bundled
23
- `Electron.app` to `Television.app` (bundle directory + inner executable +
24
- `Info.plist` + bundle icon). This is what gives the Dock and menu bar
25
- "Television" instead of "Electron".
26
-
27
- If you install with `--ignore-scripts`, the rename is skipped — the app
28
- still works but will be labelled "Electron" everywhere macOS reads the
29
- bundle.
22
+ The first launch renames the bundled `Electron.app` to `Television.app`
23
+ (bundle directory + inner executable + `Info.plist` + bundle icon). This
24
+ is what gives the Dock and menu bar "Television" instead of "Electron".
25
+ First launch is a few seconds slower; every launch after takes the fast
26
+ path.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const { spawn } = require("node:child_process");
2
+ const { spawn, spawnSync } = require("node:child_process");
3
3
  const path = require("node:path");
4
4
  const fs = require("node:fs");
5
5
 
@@ -11,6 +11,17 @@ function resolveExecutable() {
11
11
  if (process.platform === "darwin") {
12
12
  const renamed = path.join(distDir, "Television.app", "Contents", "MacOS", "Television");
13
13
  if (fs.existsSync(renamed)) return renamed;
14
+ // npm runs our package's postinstall before electron's postinstall has
15
+ // downloaded the Electron.app, so we can't rely on a postinstall hook.
16
+ // Rename lazily on first launch (idempotent); subsequent launches take
17
+ // the fast path above.
18
+ const upstream = path.join(distDir, "Electron.app");
19
+ if (fs.existsSync(upstream)) {
20
+ spawnSync(process.execPath, [path.join(appDir, "scripts", "rename-bundle.cjs")], {
21
+ stdio: "inherit",
22
+ });
23
+ if (fs.existsSync(renamed)) return renamed;
24
+ }
14
25
  }
15
26
  return require("electron");
16
27
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@telepath-computer/television-desktop",
3
3
  "productName": "Television",
4
- "version": "0.1.107",
4
+ "version": "0.1.112",
5
5
  "type": "module",
6
6
  "main": "dist/electron.cjs",
7
7
  "bin": {
@@ -11,14 +11,13 @@
11
11
  "dist/**",
12
12
  "bin/**",
13
13
  "assets/**",
14
- "scripts/postinstall.cjs"
14
+ "scripts/rename-bundle.cjs"
15
15
  ],
16
16
  "exports": {
17
17
  ".": "./src/index.ts"
18
18
  },
19
19
  "scripts": {
20
20
  "build": "node build.mjs",
21
- "postinstall": "node scripts/postinstall.cjs",
22
21
  "prepublishOnly": "node build.mjs",
23
22
  "type-check": "tsc -p tsconfig.json --noEmit"
24
23
  },
@@ -4,7 +4,13 @@
4
4
  // "Television" instead of "Electron". macOS reads the running-app name
5
5
  // from the bundle's filesystem identity; just editing Info.plist isn't
6
6
  // enough — the .app directory and Contents/MacOS/<exe> have to match.
7
- // Scoped to this package's resolved electron install.
7
+ // Scoped to this package's resolved electron install. Idempotent; no-ops
8
+ // once the rename is complete.
9
+ //
10
+ // Invoked lazily on first launch by bin/tv-desktop.cjs. We can't use an
11
+ // npm `postinstall` hook because npm runs our package's postinstall
12
+ // before electron's postinstall has downloaded Electron.app — the rename
13
+ // has nothing to rename at install time.
8
14
 
9
15
  const { execFileSync } = require("node:child_process");
10
16
  const path = require("node:path");