Skip to content

feat: add node-pre-gyp support#1095

Merged
georgexu99 merged 13 commits intoelectron:mainfrom
samuelmaddock:feat/node-pre-gyp
Aug 21, 2023
Merged

feat: add node-pre-gyp support#1095
georgexu99 merged 13 commits intoelectron:mainfrom
samuelmaddock:feat/node-pre-gyp

Conversation

@samuelmaddock
Copy link
Member

@mapbox/node-pre-gyp is a popular choice for serving prebuilt native node module binaries. These changes add support for downloading prebuilt binaries using it as well as rebuilding in the case that no prebuilt binaries are found.

A skipPrebuilds option was added to give tests the ability to force rebuilds without using any prebuilt binary modules.

node-sqlite3 is used to test for node-pre-gyp support.

resolves #367

@samuelmaddock samuelmaddock requested a review from a team as a code owner August 2, 2023 20:54
@codecov-commenter
Copy link

codecov-commenter commented Aug 2, 2023

Codecov Report

❌ Patch coverage is 82.05128% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.30%. Comparing base (37babee) to head (ff4bd84).
⚠️ Report is 76 commits behind head on main.

Files with missing lines Patch % Lines
src/module-type/node-pre-gyp.ts 75.00% 3 Missing and 3 partials ⚠️
src/module-rebuilder.ts 92.85% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1095      +/-   ##
==========================================
+ Coverage   76.01%   76.30%   +0.29%     
==========================================
  Files          20       21       +1     
  Lines         688      726      +38     
  Branches      129      136       +7     
==========================================
+ Hits          523      554      +31     
- Misses        118      121       +3     
- Partials       47       51       +4     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

src/cli.ts Outdated
useElectronClang: !!argv.useElectronClang,
disablePreGypCopy: !!argv.disablePreGypCopy,
projectRootPath,
skipPrebuilds: !!argv.skipPrebuilds,
Copy link
Member

Choose a reason for hiding this comment

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

Does this new option also impact prebuild or just node-pre-gyp?

Copy link
Member

Choose a reason for hiding this comment

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

It also appears to have a buildFromSource behavior rather than "skipping" the module entirely

Copy link
Contributor

Choose a reason for hiding this comment

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

renamed prebuild -> buildFromSource

@dsanders11
Copy link
Member

@samuelmaddock, you can rebase this on main to pick up #1098 so that Windows CI won't be flaky.

georgexu99 and others added 2 commits August 8, 2023 11:50
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
Copy link
Member

@VerteDinde VerteDinde left a comment

Choose a reason for hiding this comment

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

The code changes look good to me


export async function cleanupTestModule(testModulePath: string): Promise<void> {
await fs.remove(testModulePath);
await fs.rmdir(testModulePath, { recursive: true, maxRetries: 10 });
Copy link
Member

Choose a reason for hiding this comment

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

?

it('should not fail running prebuild-install', async () => {
it('should not fail running prebuild-install', async function () {
if (process.platform === 'darwin' && process.arch === 'arm64') {
this.skip(); // farmhash module has no prebuilt binaries for ARM64
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
this.skip(); // farmhash module has no prebuilt binaries for ARM64
this.skip(); // farmhash module has no prebuilt binaries for ARM64
return;

@georgexu99 georgexu99 merged commit e71316b into electron:main Aug 21, 2023
georgexu99 added a commit that referenced this pull request Aug 21, 2023
@georgexu99
Copy link
Contributor

o shoot, I merged before sam's comments loaded :PPP I'll make a new pr to address these

@continuous-auth
Copy link

🎉 This PR is included in version 3.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node-pre-gyp support in the same way than prebuild is supported

6 participants