diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af53fde..89f72a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,18 +13,21 @@ jobs: strategy: matrix: os: [macos-latest, windows-latest, ubuntu-latest] - node: [16, 18] - electron: [23, 20] + node: [20, 18] + electron: [30, 28, 23] exclude: - # older electron seems to misbehave on apple silicon - - os: macos-latest - electron: 20 + # there's an issue with signals in retry-cli on linux in node 20 🤷‍♀️ + - os: ubuntu-latest + node: 20 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 diff --git a/src/hook.js b/src/hook.js index af7ae04..bc61618 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,25 @@ 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 arg of args) { + try { + const argPath = path.resolve(arg); + const file = require.resolve(argPath); + pathmap[file] = true; + queue({ type: 'discover', file }); + } catch (e) { + // you know... because lint + e; + } + } +})(process.argv.slice(3)); +// we run `electron --require hook.js ...` +// so remove the first 3 arguments + function exit(code) { electron.app.on('will-quit', () => { electron.app.exit(code);