-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
feat: add ability to specify additional npm rebuild args #881
Conversation
if (additionalArgs) { | ||
if (Array.isArray(additionalArgs)) { | ||
additionalArgs.forEach(arg => npmExecArgs.push(arg)) | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put else on next line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
@@ -54,6 +54,14 @@ export function spawnNpmProduction(command: string, appDir: string, forceBuildFr | |||
npmExecArgs.push("--build-from-source") | |||
} | |||
|
|||
if (additionalArgs) { | |||
if (Array.isArray(additionalArgs)) { | |||
additionalArgs.forEach(arg => npmExecArgs.push(arg)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use spread operator here: npmExecArgs.push(...additionalArgs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
@@ -237,11 +237,12 @@ export class Packager implements BuildInfo { | |||
} | |||
else { | |||
const forceBuildFromSource = this.devMetadata.build.npmSkipBuildFromSource !== true | |||
const additionalArgs = this.devMetadata.build.npmArgs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Var is used only in the one else branch, please inline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
Probably we should always pass |
@develar yes, that would work too. But |
I suppose it will be more good solution — to avoid explicit configuration. To simplify developer life. |
I've addressed those review notes. I think that electron-builder should handle setting the @develar Shall I create an issue? |
PR about abi version is welcome :) Thanks for spotting it. |
Whoops, when fixing code as per review in #881, accidentally broke the code.
I am building an electron app that uses native dependencies targeting multiple platforms. Prebuild binaries are available for all of them.
However when
npmSkipBuildFromSource
is enabled,prebuild
downloads the binary for the installed node version instead of the electron version. This can be easily handled by specifying a--abi=ELECTRON_ABI_VERSION
argument, but electron-builder does not allow this.This PR adds support for specifying any number of additional
npm rebuild
arguments to allow working around issues outlined above.