Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update node-gyp to ^10.0.0 and fix subsequent breaking changes #1128

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tarekis
Copy link

@tarekis tarekis commented Mar 2, 2024

I took a shot at upgrading node-gyp to ^10.0.0, because electron-rebuild does not work with python 3.12.x as mentioned in #1116.
This change is non-breaking and backwards-compatible with python 3.11.x since node-gyp@10.0.1 also is.

The obvious change here is updaring node-gyp to ^10.0.0, but there are some errors that arise from doing so.

So this PR also fixes errors introduced by this upgrade:

  • Removes promisifying of node-gyp commands called in the worker, and instead calls the node-gyp APIs directly as they were promisified internally as notend in the v10.0.0 breaking changes.

  • dev only: @types/minipass are set to ^3.3.5 because tar has a dependency version of * but the set version is required, as recommended here.

  • dev only: Trough peer dependencies v10.0.0 introduces dependencies to string-width @ ^5.0.1 and ^5.1.2, which are ESM modules, and since @electron/rebuild targets CommonJS this fails with ESM Errors. Since a yarn lockfile is used, I used yarn-specific overrides (speak: resolutions) to force the usage of 4.2.3, which does not target ESM, and thus works with a CommonJS target.
    This probably could be done more gracefully, but this works for now, and only affects dev, so if you'd like to have this done differently, please manually seek some versions that work and update the lockfile.

@tarekis tarekis requested a review from a team as a code owner March 2, 2024 18:56
@codecov-commenter
Copy link

codecov-commenter commented Mar 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.37%. Comparing base (96d0d3d) to head (99fc935).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1128      +/-   ##
==========================================
- Coverage   77.06%   76.37%   -0.69%     
==========================================
  Files          21       21              
  Lines         763      762       -1     
  Branches      142      142              
==========================================
- Hits          588      582       -6     
- Misses        122      125       +3     
- Partials       53       55       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tarekis
Copy link
Author

tarekis commented Mar 2, 2024

I suppose it is breaking for node v12/14.
What is the policy here, considering these versions are officially out of maintenance?

Also, this doesn't seem to work on Windows. Well, that's a bummer.

This fails:

C:\Users\circleci\AppData\Local\Temp\electron-rebuild-test\node_modules\ffi-napi\build\deps\libffi\ffi.targets(34,5): error MSB3721: The command "call "call" "../../../deps/libffi/preprocess_asm.cmd" "../../../deps/libffi/include" "../../../deps/libffi/config/win/x64" "..\..\..\deps\libffi\src\x86\win64_intel.preasm" "Release\obj\ffi\win64_intel.asm"" exited with code 1. [C:\Users\circleci\AppData\Local\Temp\electron-rebuild-test\node_modules\ffi-napi\build\deps\libffi\ffi.vcxproj]
Done Building Project "C:\Users\circleci\AppData\Local\Temp\electron-rebuild-test\node_modules\ffi-napi\build\deps\libffi\ffi.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\Users\circleci\AppData\Local\Temp\electron-rebuild-test\node_modules\ffi-napi\build\binding.sln" (default targets) -- FAILED.

I'm not experience enough to comment on why specifically windows won't build here as of yet. Maybe someone else has a clue.

Latest cricleci before this change suceeds for Windows + Node 20, circli for this change does not.

Copy link
Member

@MarshallOfSound MarshallOfSound left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolutions won't propagate to folks who install this module, this would be a breaking change for them. This is on my list of things to look at

@clemenshimmer
Copy link

I see, the resolutions introduced by me here do not propagate when one installs?
Was I mistaken assuming this only affects developing @electron/rebuild, and also affects the actual usage of electron-rebuild when installed?

Totally broken on Windows still tho, no idea what fails on the Win build system tho. IMHO node v12/14 could realistically be wontfixes, but Windows has to work first anyway.

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.

None yet

4 participants