Skip to content

armgit / plexo

Public Imported from GitHub
0

Speed up downloads by combining multiple network connections in parallel

fix: use install-electron instead of custom script

Anmol Kapil1861af2668f3
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d77747c..8195ce7 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -24,8 +24,9 @@ jobs:
node-version: 22
cache: npm
- # --ignore-scripts skips Electron's binary download and
- # electron-builder's native rebuild. Both are needed to *run* the app;
+ # --ignore-scripts skips our postinstall: Electron's binary download
+ # (install-electron) and electron-builder's native rebuild. Both are
+ # needed to *run* the app;
# linting, typechecking and format-checking need only the packages
# themselves, and that download would otherwise dominate every run.
- name: Install dependencies
diff --git a/package.json b/package.json
index 879fe3f..ac42060 100644
--- a/package.json
+++ b/package.json
@@ -12,11 +12,12 @@
"typecheck:web": "tsc --noEmit -p tsconfig.web.json --composite false",
"typecheck:e2e": "tsc -p tsconfig.e2e.json",
"typecheck": "npm run typecheck:node && npm run typecheck:web && npm run typecheck:e2e",
+ "prestart": "install-electron",
"start": "electron-vite preview",
- "predev": "node scripts/ensure-electron.mjs",
+ "predev": "install-electron",
"dev": "electron-vite dev",
"build": "npm run typecheck && electron-vite build",
- "postinstall": "electron-builder install-app-deps",
+ "postinstall": "install-electron && electron-builder install-app-deps",
"build:unpack": "npm run build && electron-builder --dir",
"build:win": "npm run build && electron-builder --win",
"build:mac": "electron-vite build && electron-builder --mac",
diff --git a/scripts/ensure-electron.mjs b/scripts/ensure-electron.mjs
deleted file mode 100644
index ce1ddf0..0000000
--- a/scripts/ensure-electron.mjs
+++ /dev/null
@@ -1,9 +0,0 @@
-// Electron's binary download can silently fail during `npm install` (network, interrupted install).
-// Without it, `electron-vite dev` dies with "Electron uninstall". Re-run the installer if it's missing.
-import { existsSync } from 'node:fs'
-import { execFileSync } from 'node:child_process'
-
-if (!existsSync('node_modules/electron/path.txt')) {
- console.log('Electron binary missing, downloading...')
- execFileSync(process.execPath, ['node_modules/electron/install.js'], { stdio: 'inherit' })
-}