Skip to content

Modernize - Windows Build - #1401

Open
aaroncox wants to merge 7 commits into
modernizefrom
modernize-build
Open

Modernize - Windows Build#1401
aaroncox wants to merge 7 commits into
modernizefrom
modernize-build

Conversation

@aaroncox

@aaroncox aaroncox commented Aug 7, 2026

Copy link
Copy Markdown
Member

No description provided.

Migrates config to the v26 schema: linux.desktop entries nest under
`entry`, and win.publisherName moves into signtoolOptions. Drops the
dead greymass.pfx reference.

Windows packaging can no longer be cross-compiled from macOS —
@electron/rebuild does not support node-hid's pkg-prebuilds binaries.
Documented in AGENTS.md.
`@ledgerhq/hw-transport-node-hid@6.6.0` is TypeScript-compiled to ES5 and
inherits via the `__extends` helper, whose generated constructor calls
`_super.apply(this, arguments)`. It declares its base class as
`@ledgerhq/hw-transport-node-hid-noevents@^6.6.0`, and that caret range had
floated to 6.35.4, which ships a native ES6 `class`. Invoking an ES6 class
via `.apply()` throws, so every connection attempt failed with:

    TypeError: Class constructor TransportNodeHidNoEvents
    cannot be invoked without 'new'

This regressed in 77819d0, which added the node-hid/usb resolutions and
regenerated app/yarn.lock; the base class drifted as a side effect. Ledger
has been broken on this branch since, on all platforms.

The failure also leaked HID handles. `TransportNodeHid.open()` evaluates
`new HID(path)` as an argument before the constructor that throws, so the
opened device was orphaned with no reference and no close(). The leaked
handle blocked the next retry with "cannot open device" until GC reclaimed
it, producing an endless alternation between the two errors.

Upgrade the transport to 6.33.5 so both sides of the inheritance are ES6.
This requires moving the `usb` resolution from 1.7.2 to 2.9.0: 6.33.5's
listenDevices.js uses the usb 2.x named-export API (`usb.usb.on("attach")`),
which does not exist in 1.7.2 where the module *is* the binding. usb 2.9.0
also ships N-API prebuilds for win32-x64 and win32-ia32, removing the
per-arch source compile and surviving future Electron upgrades.

Bound the reconnect loop so a persistent failure no longer retries forever
and keeps the device busy. A renderer-initiated request resets the budget.
Also align before-quit on clearTimeout, matching the setTimeout handle.

Verified on Windows against a Nano X: transport opens and transactions sign.
The suite was written in 2019 and enforced by CircleCI until the npm to yarn
migration broke that config, which then went unnoticed for years. By now 55 of
the 61 files only asserted that components rendered exactly as they did in 2019,
and Jest 24 could no longer parse its own dependencies, so nothing had run in a
long time.

Drops jest, enzyme, react-test-renderer and eslint-plugin-jest along with the
test files, the dead CircleCI config, and the RunTests script no package script
referenced. 221 packages leave the lockfile. @babel/polyfill stays: the main
webpack config and main.dev.js both import it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant