Stop packing what only the compiler needs - #38
Merged
Conversation
node-gyp compiles a native module at install time, and a shipped app compiles nothing: node-gyp-build is what loads the prebuilt binding at runtime. It arrives because @serialport/bindings-cpp declares it, and it brings a tree that was most of what got packed. tar, glob and cacache were all in the asar this way, which is also where the alerts filed against them come from. The names are every package reachable from the production dependencies only through node-gyp, derived from yarn.lock rather than written out by hand. What the asar holds afterwards is the serialport family, modbus-serial, and the five the app imports itself. The serial specs pass against the packaged app, which is what proves the binding still loads.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The packed app carried
node-gypand its whole tree. That is where thetar,globandcacachealerts live, and it is most of what was in the asar.node-gypcompiles a native module at install time. A shipped app compiles nothing:node-gyp-buildis what finds the prebuilt binding at runtime. It arrives because@serialport/bindings-cppdeclares it.The list is derived, not written
Every package reachable from the production dependencies only through node-gyp, computed from
yarn.lock. A name that disappears makes its pattern match nothing; a name that appears later is packed until the list is derived again. The comment inelectron-builder.ymlsays so.What the asar holds now
The serialport family, modbus-serial, and the five the app imports itself. No tar, no glob, no cacache, no node-gyp.
What proves it
The specs that use a serial port, run against the packaged app:
16-client-rtu,23-server-rtu,25-disconnect-messagesand the navigation spec, green on macOS Intel. Those are the ones that fail first if the binding cannot be loaded.The full matrix runs on this branch, packaged mode included, which is the mode that matters here.
What this does not do
It does not close the alerts. Dependabot reads the lockfile, and those packages stay in the tree because the install still needs them. #37 is the other half: it holds tar at a version past every fix the open alerts name.