Skip to content

feat: migrate electronDownload to use electron/get official package to support mirrors (BREAKING) #8827

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/poor-bats-clap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"app-builder-lib": major
"builder-util": patch
---

feat: migrate electronDownload to use `electron/get` official package. provides much better support for mirrors (BREAKING)
2 changes: 2 additions & 0 deletions packages/app-builder-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"@develar/schema-utils": "~2.6.5",
"@electron/asar": "3.4.1",
"@electron/fuses": "^1.8.0",
"@electron/get": "^3.1.0",
"@electron/notarize": "2.5.0",
"@electron/osx-sign": "1.3.3",
"@electron/rebuild": "3.7.2",
Expand All @@ -58,6 +59,7 @@
"async-exit-hook": "^2.0.1",
"builder-util": "workspace:*",
"builder-util-runtime": "workspace:*",
"chalk": "^4",
"chromium-pickle-js": "^0.2.0",
"config-file-ts": "0.2.8-rc1",
"debug": "^4.3.4",
Expand Down
95 changes: 52 additions & 43 deletions packages/app-builder-lib/scheme.json
Original file line number Diff line number Diff line change
Expand Up @@ -1010,55 +1010,26 @@
"ElectronDownloadOptions": {
"additionalProperties": false,
"properties": {
"arch": {
"type": "string"
},
"cache": {
"description": "The [cache location](https://github.com/electron-userland/electron-download#cache-location).",
"type": [
"null",
"string"
]
},
"customDir": {
"type": [
"null",
"string"
]
},
"customFilename": {
"type": [
"null",
"string"
]
"checksums": {
"type": "object"
},
"isVerifyChecksum": {
"force": {
"description": "Whether to download an artifact regardless of whether it's in the cache directory.",
"type": "boolean"
},
"mirror": {
"description": "The mirror.",
"type": [
"null",
"string"
]
"isGeneric": {
"const": false,
"type": "boolean"
},
"platform": {
"enum": [
"darwin",
"linux",
"mas",
"win32"
],
"type": "string"
"mirrorOptions": {
"$ref": "#/definitions/MirrorOptions",
"description": "Options related to specifying an artifact mirror."
},
"strictSSL": {
"unsafelyDisableChecksums": {
"description": "When set to `true`, disables checking that the artifact download completed successfully\nwith the correct payload.",
"type": "boolean"
},
"version": {
"type": "string"
}
},
"type": "object"
}
},
"FileAssociation": {
"additionalProperties": false,
Expand Down Expand Up @@ -3617,6 +3588,40 @@
},
"type": "object"
},
"MirrorOptions": {
"additionalProperties": false,
"description": "Options for specifying an alternative download mirror for Electron.",
"properties": {
"customDir": {
"description": "The name of the directory to download from,\noften scoped by version number e.g 'v4.0.4'",
"type": "string"
},
"customFilename": {
"description": "The name of the asset to download,\ne.g 'electron-v4.0.4-linux-x64.zip'",
"type": "string"
},
"customVersion": {
"description": "The version of the asset to download,\ne.g '4.0.4'",
"type": "string"
},
"mirror": {
"description": "The base URL of the mirror to download from.\ne.g https://github.com/electron/electron/releases/download",
"type": "string"
},
"nightlyMirror": {
"description": "The mirror URL for [`electron-nightly`](https://npmjs.com/package/electron-nightly),\nwhich lives in a separate npm package.",
"type": "string"
},
"nightly_mirror": {
"type": "string"
},
"resolveAssetURL": {
"description": "A function allowing customization of the url returned\nfrom getArtifactRemoteURL().",
"typeof": "function"
}
},
"type": "object"
},
"MsiOptions": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -5357,6 +5362,10 @@
],
"type": "object"
},
"Record<string,string>": {
"additionalProperties": false,
"type": "object"
},
"ReleaseInfo": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -7112,7 +7121,7 @@
},
"electronDownload": {
"$ref": "#/definitions/ElectronDownloadOptions",
"description": "The [electron-download](https://github.com/electron-userland/electron-download#usage) options."
"description": "The [electron/get](https://github.com/electron/get) options."
},
"electronFuses": {
"anyOf": [
Expand Down
3 changes: 1 addition & 2 deletions packages/app-builder-lib/src/Framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { AfterPackContext, ElectronPlatformName, Platform, PlatformPackager } fr
export interface Framework {
readonly name: string
readonly version: string
readonly distMacOsAppName: string
readonly productName: string
readonly macOsDefaultTargets: Array<string>
readonly defaultAppIdPrefix: string

Expand Down Expand Up @@ -46,7 +46,6 @@ export interface PrepareApplicationStageDirectoryOptions {
readonly appOutDir: string
readonly platformName: ElectronPlatformName
readonly arch: string
readonly version: string
}

export function isElectronBased(framework: Framework): boolean {
Expand Down
5 changes: 3 additions & 2 deletions packages/app-builder-lib/src/configuration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Arch } from "builder-util"
import { BeforeBuildContext, Target } from "./core"
import { ElectronBrandingOptions, ElectronDownloadOptions } from "./electron/ElectronFramework"
import { ElectronBrandingOptions } from "./electron/ElectronFramework"
import { PrepareApplicationStageDirectoryOptions } from "./Framework"
import { AppXOptions } from "./options/AppXOptions"
import { AppImageOptions, DebOptions, FlatpakOptions, LinuxConfiguration, LinuxTargetSpecificOptions } from "./options/linuxOptions"
Expand All @@ -16,6 +16,7 @@ import { BuildResult } from "./packager"
import { ArtifactBuildStarted, ArtifactCreated } from "./packagerApi"
import { PlatformPackager } from "./platformPackager"
import { NsisOptions, NsisWebOptions, PortableOptions } from "./targets/nsis/nsisOptions"
import { ElectronDownloadOptions } from "./util/electronGet"

// duplicate appId here because it is important
/**
Expand Down Expand Up @@ -201,7 +202,7 @@ export interface Configuration extends CommonConfiguration, PlatformSpecificBuil
readonly electronCompile?: boolean

/**
* The [electron-download](https://github.com/electron-userland/electron-download#usage) options.
* The [electron/get](https://github.com/electron/get) options.
*/
readonly electronDownload?: ElectronDownloadOptions

Expand Down
Loading
Loading