Skip to content

Conversation

@mmaietta
Copy link
Collaborator

Current logic already uses env var ELECTRON_BUILDER_BINARIES_MIRROR

func downloadFromGithub(name string, version string, checksum string) (string, error) {
id := name + "-" + version
return DownloadArtifact(id, GetGithubBaseUrl()+id+"/"+id+".7z", checksum)
}
func GetGithubBaseUrl() string {
v := os.Getenv("NPM_CONFIG_ELECTRON_BUILDER_BINARIES_MIRROR")
if len(v) == 0 {
v = os.Getenv("npm_config_electron_builder_binaries_mirror")
}
if len(v) == 0 {
v = os.Getenv("npm_package_config_electron_builder_binaries_mirror")
}
if len(v) == 0 {
v = os.Getenv("ELECTRON_BUILDER_BINARIES_MIRROR")
}
if len(v) == 0 {
v = "https://github.com/electron-userland/electron-builder-binaries/releases/download/"
}
return v
}

But it does not allow customization of the dir (both being the id of the asset)

return DownloadArtifact(id, GetGithubBaseUrl()+id+"/"+id+".7z", checksum)

This implementation now will properly mirror the (duplicated) logic in electron-builder for app-builder-bin downloading
https://github.com/electron-userland/electron-builder/blob/3d65267a6c53ca824f70e5b0f5d8f4ba8be38237/packages/app-builder-lib/src/binDownload.ts#L25-L38

@mmaietta mmaietta merged commit 9b2aaff into master Apr 23, 2025
2 checks passed
@mmaietta mmaietta deleted the feat/allow-custom-dirs branch April 23, 2025 22:19
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.

2 participants