diff --git a/.yarn/patches/electron-npm-40.9.2-7b90992bd7.patch b/.yarn/patches/electron-npm-40.9.2-7b90992bd7.patch new file mode 100644 index 0000000000..cc13ad9229 --- /dev/null +++ b/.yarn/patches/electron-npm-40.9.2-7b90992bd7.patch @@ -0,0 +1,66 @@ +# Patches the Electron installer to use a Zip extraction library +# that works with newer NodeJS versions. +# See https://github.com/max-mapper/extract-zip/issues/154 +diff --git a/install.js b/install.js +index 9d7ecaf55d29b67de146f8359083fe4b4548a2bf..5923221cd647efee37dc20f6438dc98a504e2574 100644 +--- a/install.js ++++ b/install.js +@@ -2,7 +2,7 @@ + + const { downloadArtifact } = require('@electron/get'); + +-const extract = require('extract-zip'); ++const AdmZip = require('adm-zip'); + + const childProcess = require('child_process'); + const fs = require('fs'); +@@ -74,20 +74,24 @@ function isInstalled () { + function extractFile (zipPath) { + const distPath = process.env.ELECTRON_OVERRIDE_DIST_PATH || path.join(__dirname, 'dist'); + +- return extract(zipPath, { dir: path.join(__dirname, 'dist') }).then(() => { +- // If the zip contains an "electron.d.ts" file, +- // move that up +- const srcTypeDefPath = path.join(distPath, 'electron.d.ts'); +- const targetTypeDefPath = path.join(__dirname, 'electron.d.ts'); +- const hasTypeDefinitions = fs.existsSync(srcTypeDefPath); ++ const outputPath = path.join(__dirname, 'dist'); ++ const zip = new AdmZip(zipPath); ++ const keepPermissions = true; // Extracted binaries must be executable ++ const overwrite = false; ++ zip.extractAllTo(outputPath, overwrite, keepPermissions); + +- if (hasTypeDefinitions) { +- fs.renameSync(srcTypeDefPath, targetTypeDefPath); +- } ++ // If the zip contains an "electron.d.ts" file, ++ // move that up ++ const srcTypeDefPath = path.join(distPath, 'electron.d.ts'); ++ const targetTypeDefPath = path.join(__dirname, 'electron.d.ts'); ++ const hasTypeDefinitions = fs.existsSync(srcTypeDefPath); ++ ++ if (hasTypeDefinitions) { ++ fs.renameSync(srcTypeDefPath, targetTypeDefPath); ++ } + +- // Write a "path.txt" file. +- return fs.promises.writeFile(path.join(__dirname, 'path.txt'), platformPath); +- }); ++ // Write a "path.txt" file. ++ return fs.promises.writeFile(path.join(__dirname, 'path.txt'), platformPath); + } + + function getPlatformPath () { +diff --git a/package.json b/package.json +index 3aae0028f84645586b484d680375e0a318b4c13f..126aa83f05869f17bc4fab22926eae5c478d775c 100644 +--- a/package.json ++++ b/package.json +@@ -19,7 +19,7 @@ + "dependencies": { + "@electron/get": "^2.0.0", + "@types/node": "^24.9.0", +- "extract-zip": "^2.0.1" ++ "adm-zip": "0.5.16" + }, + "scripts": { + "postinstall": "node install.js" diff --git a/.yarnrc.yml b/.yarnrc.yml index 4cb6d767f2..02e16367e2 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -33,3 +33,18 @@ logFilters: # needs to be done so it's just security theater that we have no choice but to # disable. checksumBehavior: update + +# Workaround: May 29th, 2026: The default Electron installer is unreliable in CI +# with recent versions of NodeJS. +# +# To resolve this, we patch Electron to use a different library for ZIP +# extraction. This requires a dependency override because Yarn patches +# can't change the dependency tree: +# https://yarnpkg.com/features/patching#limitations +packageExtensions: { + electron@*: { + dependencies: { + adm-zip: "0.5.16" + } + } +} diff --git a/packages/app-desktop/package.json b/packages/app-desktop/package.json index 68590d935e..231f1fb0dc 100644 --- a/packages/app-desktop/package.json +++ b/packages/app-desktop/package.json @@ -171,7 +171,7 @@ "color": "3.2.1", "compare-versions": "6.1.1", "debounce": "1.2.1", - "electron": "40.9.2", + "electron": "patch:electron@npm%3A40.9.2#~/.yarn/patches/electron-npm-40.9.2-7b90992bd7.patch", "electron-builder": "24.13.3", "electron-updater": "6.6.8", "electron-window-state": "5.0.3", diff --git a/yarn.lock b/yarn.lock index 311fc2416d..628be6fe4c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12293,7 +12293,7 @@ __metadata: color: "npm:3.2.1" compare-versions: "npm:6.1.1" debounce: "npm:1.2.1" - electron: "npm:40.9.2" + electron: "patch:electron@npm%3A40.9.2#~/.yarn/patches/electron-npm-40.9.2-7b90992bd7.patch" electron-builder: "npm:24.13.3" electron-updater: "npm:6.6.8" electron-window-state: "npm:5.0.3" @@ -29227,6 +29227,19 @@ __metadata: languageName: node linkType: hard +"electron@patch:electron@npm%3A40.9.2#~/.yarn/patches/electron-npm-40.9.2-7b90992bd7.patch": + version: 40.9.2 + resolution: "electron@patch:electron@npm%3A40.9.2#~/.yarn/patches/electron-npm-40.9.2-7b90992bd7.patch::version=40.9.2&hash=b45f79" + dependencies: + "@electron/get": "npm:^2.0.0" + "@types/node": "npm:^24.9.0" + extract-zip: "npm:^2.0.1" + bin: + electron: cli.js + checksum: 10/b53939ed973e797ca4090ba5e94aba2ddbae81d985bf34b39ca11ff4df4fc20316bfa5477152c3cae665da6a08d726e46b3cf0d2e6ce777d2f7575483bfea99d + languageName: node + linkType: hard + "elkjs@npm:^0.8.2": version: 0.8.2 resolution: "elkjs@npm:0.8.2"