From 91ad93310adb1332176b8e56ec39c19feeee87f1 Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Sun, 28 Apr 2024 00:38:52 -0400 Subject: [PATCH 1/8] updating to newer versions of electron and node --- .github/workflows/ci.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af53fde..de0a016 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,18 +13,17 @@ jobs: strategy: matrix: os: [macos-latest, windows-latest, ubuntu-latest] - node: [16, 18] - electron: [23, 20] - exclude: - # older electron seems to misbehave on apple silicon - - os: macos-latest - electron: 20 + node: [20, 18] + electron: [30, 28, 23] include: - os: ubuntu-latest - node: 14 + node: 16 + electron: 20 + - os: ubuntu-latest + node: 16 electron: 18 - os: ubuntu-latest - node: 14 + node: 16 electron: 16 - os: windows-latest node: 14 From 5b6b7982e54198657344b3216061199db6fc8465 Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Sun, 28 Apr 2024 00:42:26 -0400 Subject: [PATCH 2/8] ignoring node 20 on ubuntu retry-cli has an issue --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de0a016..89f72a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,10 @@ jobs: os: [macos-latest, windows-latest, ubuntu-latest] node: [20, 18] electron: [30, 28, 23] + exclude: + # there's an issue with signals in retry-cli on linux in node 20 🤷‍♀️ + - os: ubuntu-latest + node: 20 include: - os: ubuntu-latest node: 16 From 1f4609cba3415e5c64218dc7bbcc17fff7428932 Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Sun, 28 Apr 2024 00:52:36 -0400 Subject: [PATCH 3/8] adding the entry file to the main process list based on the command that starts the app --- src/hook.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/hook.js b/src/hook.js index af7ae04..261f460 100644 --- a/src/hook.js +++ b/src/hook.js @@ -1,5 +1,6 @@ const electron = require('electron'); const required = require('runtime-required'); +const path = require('path'); const logLevel = process.env.ELECTRONMON_LOGLEVEL || 'info'; const log = require('./log.js')(process.stdout, logLevel); @@ -8,6 +9,21 @@ const queue = require('./message-queue.js'); const pathmap = {}; +// we can get any number of arguments... best we can do +// is check if all of them resolve to a file, and if they do +// assume that file is a main process file +(function addMainFile(args) { + for (const opt of args) { + const optPath = path.resolve(opt); + + try { + const file = require.resolve(optPath); + pathmap[file] = true; + queue({ type: 'discover', file }); + } catch (e) {} + } +})(process.argv.slice(3)); + function exit(code) { electron.app.on('will-quit', () => { electron.app.exit(code); From 9de96150c6f0817a468e23668ad5a99c3b1d3ec7 Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Sun, 28 Apr 2024 00:55:59 -0400 Subject: [PATCH 4/8] fixing lint issue --- src/hook.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hook.js b/src/hook.js index 261f460..e7a44b6 100644 --- a/src/hook.js +++ b/src/hook.js @@ -20,7 +20,10 @@ const pathmap = {}; const file = require.resolve(optPath); pathmap[file] = true; queue({ type: 'discover', file }); - } catch (e) {} + } catch (e) { + // you know... because lint + e; + } } })(process.argv.slice(3)); From 4e8c916ebe657fecf4ec398bc770e1dad0200625 Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Sun, 28 Apr 2024 00:56:22 -0400 Subject: [PATCH 5/8] updating default version of electron installed with the lib for development --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ba9a824..ffcf066 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ }, "devDependencies": { "chai": "^4.2.0", - "electron": "^23.1.0", + "electron": "^30.0.1", "eslint": "^5.16.0", "fs-extra": "^8.1.0", "mocha": "^6.2.2", From a97a6caa13d421060db56cd42d1059df89f1f802 Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Sun, 28 Apr 2024 00:58:02 -0400 Subject: [PATCH 6/8] Revert "updating default version of electron installed with the lib for development" This reverts commit 4e8c916ebe657fecf4ec398bc770e1dad0200625. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ffcf066..ba9a824 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ }, "devDependencies": { "chai": "^4.2.0", - "electron": "^30.0.1", + "electron": "^23.1.0", "eslint": "^5.16.0", "fs-extra": "^8.1.0", "mocha": "^6.2.2", From 35e3337e28b7268cd62b5e9361bb0958c7c87c87 Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Sun, 28 Apr 2024 01:00:11 -0400 Subject: [PATCH 7/8] cleanup --- src/hook.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/hook.js b/src/hook.js index e7a44b6..2a2a443 100644 --- a/src/hook.js +++ b/src/hook.js @@ -14,9 +14,8 @@ const pathmap = {}; // assume that file is a main process file (function addMainFile(args) { for (const opt of args) { - const optPath = path.resolve(opt); - try { + const optPath = path.resolve(opt); const file = require.resolve(optPath); pathmap[file] = true; queue({ type: 'discover', file }); From 2cb725ba62e5f6af74ce055e446f0af6d68ef223 Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Sun, 28 Apr 2024 01:04:29 -0400 Subject: [PATCH 8/8] cleanup --- src/hook.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/hook.js b/src/hook.js index 2a2a443..bc61618 100644 --- a/src/hook.js +++ b/src/hook.js @@ -13,10 +13,10 @@ const pathmap = {}; // is check if all of them resolve to a file, and if they do // assume that file is a main process file (function addMainFile(args) { - for (const opt of args) { + for (const arg of args) { try { - const optPath = path.resolve(opt); - const file = require.resolve(optPath); + const argPath = path.resolve(arg); + const file = require.resolve(argPath); pathmap[file] = true; queue({ type: 'discover', file }); } catch (e) { @@ -25,6 +25,8 @@ const pathmap = {}; } } })(process.argv.slice(3)); +// we run `electron --require hook.js ...` +// so remove the first 3 arguments function exit(code) { electron.app.on('will-quit', () => {