Skip to content

Commit 93de5bf

Browse files
committed
Migrating from executing app-builder to using https://github.com/electron/get
Implements: #8785 Refactors the code surrounding download/unzip/copy electron before packing begins, so this might also resolve: #6106 #8687 #8522
1 parent cb77508 commit 93de5bf

File tree

17 files changed

+353
-195
lines changed

17 files changed

+353
-195
lines changed

.changeset/poor-bats-clap.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"app-builder-lib": major
3+
"builder-util": patch
4+
---
5+
6+
feat: migrate electronDownload to use `electron/get` official package. provides much better support for mirrors (BREAKING)

packages/app-builder-lib/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"@develar/schema-utils": "~2.6.5",
5050
"@electron/asar": "3.4.1",
5151
"@electron/fuses": "^1.8.0",
52+
"@electron/get": "^3.1.0",
5253
"@electron/notarize": "2.5.0",
5354
"@electron/osx-sign": "1.3.3",
5455
"@electron/rebuild": "3.7.2",
@@ -58,6 +59,7 @@
5859
"async-exit-hook": "^2.0.1",
5960
"builder-util": "workspace:*",
6061
"builder-util-runtime": "workspace:*",
62+
"chalk": "^4",
6163
"chromium-pickle-js": "^0.2.0",
6264
"config-file-ts": "0.2.8-rc1",
6365
"debug": "^4.3.4",

packages/app-builder-lib/scheme.json

Lines changed: 52 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,55 +1010,26 @@
10101010
"ElectronDownloadOptions": {
10111011
"additionalProperties": false,
10121012
"properties": {
1013-
"arch": {
1014-
"type": "string"
1015-
},
1016-
"cache": {
1017-
"description": "The [cache location](https://github.com/electron-userland/electron-download#cache-location).",
1018-
"type": [
1019-
"null",
1020-
"string"
1021-
]
1022-
},
1023-
"customDir": {
1024-
"type": [
1025-
"null",
1026-
"string"
1027-
]
1028-
},
1029-
"customFilename": {
1030-
"type": [
1031-
"null",
1032-
"string"
1033-
]
1013+
"checksums": {
1014+
"type": "object"
10341015
},
1035-
"isVerifyChecksum": {
1016+
"force": {
1017+
"description": "Whether to download an artifact regardless of whether it's in the cache directory.",
10361018
"type": "boolean"
10371019
},
1038-
"mirror": {
1039-
"description": "The mirror.",
1040-
"type": [
1041-
"null",
1042-
"string"
1043-
]
1020+
"isGeneric": {
1021+
"const": false,
1022+
"type": "boolean"
10441023
},
1045-
"platform": {
1046-
"enum": [
1047-
"darwin",
1048-
"linux",
1049-
"mas",
1050-
"win32"
1051-
],
1052-
"type": "string"
1024+
"mirrorOptions": {
1025+
"$ref": "#/definitions/MirrorOptions",
1026+
"description": "Options related to specifying an artifact mirror."
10531027
},
1054-
"strictSSL": {
1028+
"unsafelyDisableChecksums": {
1029+
"description": "When set to `true`, disables checking that the artifact download completed successfully\nwith the correct payload.",
10551030
"type": "boolean"
1056-
},
1057-
"version": {
1058-
"type": "string"
10591031
}
1060-
},
1061-
"type": "object"
1032+
}
10621033
},
10631034
"FileAssociation": {
10641035
"additionalProperties": false,
@@ -3617,6 +3588,40 @@
36173588
},
36183589
"type": "object"
36193590
},
3591+
"MirrorOptions": {
3592+
"additionalProperties": false,
3593+
"description": "Options for specifying an alternative download mirror for Electron.",
3594+
"properties": {
3595+
"customDir": {
3596+
"description": "The name of the directory to download from,\noften scoped by version number e.g 'v4.0.4'",
3597+
"type": "string"
3598+
},
3599+
"customFilename": {
3600+
"description": "The name of the asset to download,\ne.g 'electron-v4.0.4-linux-x64.zip'",
3601+
"type": "string"
3602+
},
3603+
"customVersion": {
3604+
"description": "The version of the asset to download,\ne.g '4.0.4'",
3605+
"type": "string"
3606+
},
3607+
"mirror": {
3608+
"description": "The base URL of the mirror to download from.\ne.g https://github.com/electron/electron/releases/download",
3609+
"type": "string"
3610+
},
3611+
"nightlyMirror": {
3612+
"description": "The mirror URL for [`electron-nightly`](https://npmjs.com/package/electron-nightly),\nwhich lives in a separate npm package.",
3613+
"type": "string"
3614+
},
3615+
"nightly_mirror": {
3616+
"type": "string"
3617+
},
3618+
"resolveAssetURL": {
3619+
"description": "A function allowing customization of the url returned\nfrom getArtifactRemoteURL().",
3620+
"typeof": "function"
3621+
}
3622+
},
3623+
"type": "object"
3624+
},
36203625
"MsiOptions": {
36213626
"additionalProperties": false,
36223627
"properties": {
@@ -5357,6 +5362,10 @@
53575362
],
53585363
"type": "object"
53595364
},
5365+
"Record<string,string>": {
5366+
"additionalProperties": false,
5367+
"type": "object"
5368+
},
53605369
"ReleaseInfo": {
53615370
"additionalProperties": false,
53625371
"properties": {
@@ -7112,7 +7121,7 @@
71127121
},
71137122
"electronDownload": {
71147123
"$ref": "#/definitions/ElectronDownloadOptions",
7115-
"description": "The [electron-download](https://github.com/electron-userland/electron-download#usage) options."
7124+
"description": "The [electron/get](https://github.com/electron/get) options."
71167125
},
71177126
"electronFuses": {
71187127
"anyOf": [

packages/app-builder-lib/src/Framework.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { AfterPackContext, ElectronPlatformName, Platform, PlatformPackager } fr
55
export interface Framework {
66
readonly name: string
77
readonly version: string
8-
readonly distMacOsAppName: string
8+
readonly productName: string
99
readonly macOsDefaultTargets: Array<string>
1010
readonly defaultAppIdPrefix: string
1111

@@ -46,7 +46,6 @@ export interface PrepareApplicationStageDirectoryOptions {
4646
readonly appOutDir: string
4747
readonly platformName: ElectronPlatformName
4848
readonly arch: string
49-
readonly version: string
5049
}
5150

5251
export function isElectronBased(framework: Framework): boolean {

packages/app-builder-lib/src/configuration.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Arch } from "builder-util"
22
import { BeforeBuildContext, Target } from "./core"
3-
import { ElectronBrandingOptions, ElectronDownloadOptions } from "./electron/ElectronFramework"
3+
import { ElectronBrandingOptions } from "./electron/ElectronFramework"
44
import { PrepareApplicationStageDirectoryOptions } from "./Framework"
55
import { AppXOptions } from "./options/AppXOptions"
66
import { AppImageOptions, DebOptions, FlatpakOptions, LinuxConfiguration, LinuxTargetSpecificOptions } from "./options/linuxOptions"
@@ -16,6 +16,7 @@ import { BuildResult } from "./packager"
1616
import { ArtifactBuildStarted, ArtifactCreated } from "./packagerApi"
1717
import { PlatformPackager } from "./platformPackager"
1818
import { NsisOptions, NsisWebOptions, PortableOptions } from "./targets/nsis/nsisOptions"
19+
import { ElectronDownloadOptions } from "./util/electronGet"
1920

2021
// duplicate appId here because it is important
2122
/**
@@ -201,7 +202,7 @@ export interface Configuration extends CommonConfiguration, PlatformSpecificBuil
201202
readonly electronCompile?: boolean
202203

203204
/**
204-
* The [electron-download](https://github.com/electron-userland/electron-download#usage) options.
205+
* The [electron/get](https://github.com/electron/get) options.
205206
*/
206207
readonly electronDownload?: ElectronDownloadOptions
207208

0 commit comments

Comments
 (0)