diff --git a/docs/Options.md b/docs/Options.md
index 68a1c9a4cde..0627d2711a0 100644
--- a/docs/Options.md
+++ b/docs/Options.md
@@ -37,6 +37,7 @@ Most of the options accept `null` — for example, to explicitly set that DMG ic
* [mac macOS Specific Options](#MacOptions)
* [mas MAS (Mac Application Store) Specific Options](#MasBuildOptions)
* [nsis](#NsisOptions)
+ * [nsis Web Installer Specific Options](#NsisWebOptions)
* [pkg macOS Product Archive Options](#PkgOptions)
* [protocols URL Protocol Schemes](#Protocol)
* [squirrelWindows](#SquirrelWindowsOptions)
@@ -191,6 +192,13 @@ See [NSIS target notes](/~https://github.com/electron-userland/electron-builder/wi
| menuCategory | Whether to create submenu for start menu shortcut and program files directory. Defaults to `false`. If `true`, company name will be used. Or string value.
| artifactName | The [artifact file name pattern](/~https://github.com/electron-userland/electron-builder/wiki/Options#artifact-file-name-pattern). Defaults to `${productName} Setup ${version}.${ext}`.
+
+### `nsis` Web Installer Specific Options
+| Name | Description
+| --- | ---
+| appPackageUrl |
The application package download URL. Optional — by default computed using publish configuration.
URL like https://example.com/download/latest
allows web installer to be version independent (installer will download latest application package).
Custom X-Arch
http header is set to 32
or 64
.
+| artifactName | The [artifact file name pattern](/~https://github.com/electron-userland/electron-builder/wiki/Options#artifact-file-name-pattern). Defaults to `${productName} Web Setup ${version}.${ext}`.
+
### `pkg` macOS Product Archive Options
| Name | Description
@@ -214,7 +222,7 @@ Please note — on macOS [you need to register an `open-url` event handler](http
### `squirrelWindows`
-To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency.
+To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency. Squirrel.Windows target is maintained, but deprecated. Please use `nsis` instead.
| Name | Description
| --- | ---
diff --git a/docs/Publishing Artifacts.md b/docs/Publishing Artifacts.md
index dd9798c19c8..b9efa8e62be 100644
--- a/docs/Publishing Artifacts.md
+++ b/docs/Publishing Artifacts.md
@@ -66,10 +66,10 @@ But please consider using automatic rules instead of explicitly specifying `publ
* [publish](#PublishConfiguration)
+* [publish Amazon S3](#S3Options)
* [publish Bintray](#BintrayOptions)
-* [publish Generic (any https server)](#GenericServerOptions)
+* [publish Generic (any HTTP(S) server)](#GenericServerOptions)
* [publish GitHub](#GithubOptions)
-* [publish S3](#S3Options)
### `publish`
@@ -89,6 +89,19 @@ Amazon S3 — `https` must be used, so, if you use direct Amazon S3 endpoints, f
| **provider** | The provider, one of `github`, `s3`, `bintray`, `generic`.
| owner | The owner.
+
+### `publish` Amazon S3
+
+[Getting your credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-your-credentials.html).
+
+| Name | Description
+| --- | ---
+| **bucket** | The bucket name.
+| path | The directory path. Defaults to `/`.
+| channel | The channel. Defaults to `latest`.
+| acl | The ACL. Defaults to `public-read`.
+| storageClass | The type of storage to use for the object. One of `STANDARD`, `REDUCED_REDUNDANCY`, `STANDARD_IA`. Defaults to `STANDARD`.
+
### `publish` Bintray
| Name | Description
@@ -98,10 +111,10 @@ Amazon S3 — `https` must be used, so, if you use direct Amazon S3 endpoints, f
| user | The Bintray user account. Used in cases where the owner is an organization.
-### `publish` Generic (any https server)
+### `publish` Generic (any HTTP(S) server)
| Name | Description
| --- | ---
-| **url** | The base url. e.g. `https://s3.amazonaws.com/bucket_name`. You can use `${os}` (expanded to `mac`, `linux` or `win` according to target platform) and `${arch}` macros.
+| **url** | The base url. e.g. `https://bucket_name.s3.amazonaws.com`. You can use `${os}` (expanded to `mac`, `linux` or `win` according to target platform) and `${arch}` macros.
| channel | The channel. Defaults to `latest`.
@@ -113,17 +126,4 @@ Amazon S3 — `https` must be used, so, if you use direct Amazon S3 endpoints, f
| host | The host (including the port if need). Defaults to `github.com`.
| protocol | The protocol, one of https
or http
. Defaults to https
.
GitHub Publisher supports only https
.
-
-### `publish` S3
-
-[Getting your credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-your-credentials.html).
-
-| Name | Description
-| --- | ---
-| **bucket** | The bucket name.
-| path | The directory path. Defaults to `/`.
-| channel | The channel. Defaults to `latest`.
-| acl | The ACL. Defaults to `public-read`.
-| storageClass | The type of storage to use for the object. One of `STANDARD`, `REDUCED_REDUNDANCY`, `STANDARD_IA`. Defaults to `STANDARD`.
-
\ No newline at end of file
diff --git a/packages/electron-builder-http/src/publishOptions.ts b/packages/electron-builder-http/src/publishOptions.ts
index 260dba3e24e..1880f9322eb 100644
--- a/packages/electron-builder-http/src/publishOptions.ts
+++ b/packages/electron-builder-http/src/publishOptions.ts
@@ -30,11 +30,11 @@ export interface PublishConfiguration {
}
/*
-### `publish` Generic (any https server)
+### `publish` Generic (any HTTP(S) server)
*/
export interface GenericServerOptions extends PublishConfiguration {
/*
- The base url. e.g. `https://s3.amazonaws.com/bucket_name`. You can use `${os}` (expanded to `mac`, `linux` or `win` according to target platform) and `${arch}` macros.
+ The base url. e.g. `https://bucket_name.s3.amazonaws.com`. You can use `${os}` (expanded to `mac`, `linux` or `win` according to target platform) and `${arch}` macros.
*/
url: string
@@ -45,7 +45,7 @@ export interface GenericServerOptions extends PublishConfiguration {
}
/*
-### `publish` S3
+### `publish` Amazon S3
[Getting your credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-your-credentials.html).
*/
@@ -79,7 +79,7 @@ export interface S3Options extends PublishConfiguration {
}
export function s3Url(options: S3Options) {
- let url = `https://s3.amazonaws.com/${options.bucket}`
+ let url = `https://${options.bucket}.s3.amazonaws.com`
if (options.path != null) {
url += `/${options.path}`
}
diff --git a/packages/electron-builder/src/options/winOptions.ts b/packages/electron-builder/src/options/winOptions.ts
index 788c4070ea8..465c1906090 100644
--- a/packages/electron-builder/src/options/winOptions.ts
+++ b/packages/electron-builder/src/options/winOptions.ts
@@ -152,19 +152,29 @@ export interface NsisOptions {
readonly artifactName?: string | null
}
+/*
+ ### `nsis` Web Installer Specific Options
+ */
export interface NsisWebOptions extends NsisOptions {
/*
The application package download URL. Optional — by default computed using publish configuration.
URL like `https://example.com/download/latest` allows web installer to be version independent (installer will download latest application package).
+
+ Custom `X-Arch` http header is set to `32` or `64`.
*/
readonly appPackageUrl?: string | null
+
+ /*
+ The [artifact file name pattern](/~https://github.com/electron-userland/electron-builder/wiki/Options#artifact-file-name-pattern). Defaults to `${productName} Web Setup ${version}.${ext}`.
+ */
+ readonly artifactName?: string | null
}
/*
### `squirrelWindows`
- To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency.
+ To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency. Squirrel.Windows target is maintained, but deprecated. Please use `nsis` instead.
*/
export interface SquirrelWindowsOptions extends WinBuildOptions {
/*
diff --git a/packages/electron-builder/src/targets/nsis.ts b/packages/electron-builder/src/targets/nsis.ts
index 75297291d43..a6f0799285f 100644
--- a/packages/electron-builder/src/targets/nsis.ts
+++ b/packages/electron-builder/src/targets/nsis.ts
@@ -80,7 +80,7 @@ export default class NsisTarget extends Target {
const appInfo = packager.appInfo
const version = appInfo.version
const options = this.options
- const installerFilename = packager.expandArtifactNamePattern(options, "exe", null, "${productName} Setup ${version}.${ext}")
+ const installerFilename = packager.expandArtifactNamePattern(options, "exe", null, "${productName} " + (this.isWebInstaller ? "Web " : "") + "Setup ${version}.${ext}")
const iconPath = await packager.getResource(options.installerIcon, "installerIcon.ico") || await packager.getIconPath()
const oneClick = options.oneClick !== false
@@ -134,9 +134,9 @@ export default class NsisTarget extends Target {
throw new Error("Cannot compute app package download URL")
}
- computeDownloadUrl(publishConfigs[0], null, packager.appInfo.version, {
+ appPackageUrl = computeDownloadUrl(publishConfigs[0], null, packager.appInfo.version, {
os: Platform.WINDOWS.buildConfigurationKey,
- arch: Arch[Arch.x64]
+ arch: ""
})
defines.APP_PACKAGE_URL_IS_INCOMLETE = null
@@ -172,7 +172,7 @@ export default class NsisTarget extends Target {
await subTask(`Executing makensis — installer`, this.executeMakensis(defines, commands, true, await this.computeScript(defines, commands, installerPath)))
await packager.sign(installerPath)
- packager.dispatchArtifactCreated(installerPath, this, `${packager.appInfo.name}-Setup-${version}.exe`)
+ packager.dispatchArtifactCreated(installerPath, this, `${packager.appInfo.name}-${this.isWebInstaller ? "Web-" : ""}Setup-${version}.exe`)
}
private get isWebInstaller(): boolean {
diff --git a/packages/electron-builder/templates/nsis/installSection.nsh b/packages/electron-builder/templates/nsis/installSection.nsh
index ef49a5c34e3..235dbf9a7ae 100644
--- a/packages/electron-builder/templates/nsis/installSection.nsh
+++ b/packages/electron-builder/templates/nsis/installSection.nsh
@@ -147,30 +147,41 @@ SetOutPath $INSTDIR
File /r "${APP_BUILD_DIR}/*.*"
!else
!ifdef APP_PACKAGE_URL
- StrCpy $0 "${APP_PACKAGE_URL}"
+ Var /GLOBAL packageUrl
+ Var /GLOBAL packageArch
+
+ StrCpy $packageUrl "${APP_PACKAGE_URL}"
+ StrCpy $packageArch "${APP_PACKAGE_URL}"
+
!ifdef APP_PACKAGE_URL_IS_INCOMLETE
!ifdef APP_64_NAME
!ifdef APP_32_NAME
${if} ${RunningX64}
- StrCpy $0 "$0/${APP_64_NAME}"
+ StrCpy $packageUrl "$packageUrl/${APP_64_NAME}"
${else}
- StrCpy $0 "$0/${APP_32_NAME}"
+ StrCpy $packageUrl "$packageUrl/${APP_32_NAME}"
${endif}
!else
- StrCpy $0 "$0/${APP_64_NAME}"
+ StrCpy $packageUrl "$packageUrl/${APP_64_NAME}"
!endif
!else
- StrCpy $0 "$0/${APP_32_NAME}"
+ StrCpy $packageUrl "$packageUrl/${APP_32_NAME}"
!endif
!endif
+ ${if} ${RunningX64}
+ StrCpy $packageArch "64"
+ ${else}
+ StrCpy $packageArch "32"
+ ${endif}
+
download:
- inetc::get /RESUME "$0" "$PLUGINSDIR\package.7z"
- pop $0
+ inetc::get /header "X-Arch: $packageArch" /RESUME "" "$packageUrl" "$PLUGINSDIR\package.7z" /END
+ Pop $0
${if} $0 == "Cancelled"
quit
${elseif} $0 != "OK"
- messagebox MB_RETRYCANCEL|MB_ICONEXCLAMATION "Unable to download application package (status: $0).$\r$\n$\r$\nPlease check you Internet connection and retry." IDRETRY download
+ Messagebox MB_RETRYCANCEL|MB_ICONEXCLAMATION "Unable to download application package from $packageUrl (status: $0).$\r$\n$\r$\nPlease check you Internet connection and retry." IDRETRY download
quit
${endif}
diff --git a/test/out/windows/__snapshots__/nsisTest.js.snap b/test/out/windows/__snapshots__/nsisTest.js.snap
index 3105371740b..87179548a71 100644
--- a/test/out/windows/__snapshots__/nsisTest.js.snap
+++ b/test/out/windows/__snapshots__/nsisTest.js.snap
@@ -112,13 +112,13 @@ Object {
exports[`test web installer 1`] = `
Array [
- "Test App ßW Setup 1.1.0.exe",
+ "Test App ßW Web Setup 1.1.0.exe",
"TestApp-1.1.0-x64.nsis.7z",
]
`;
exports[`test web installer 2`] = `
Array [
- "TestApp-Setup-1.1.0.exe",
+ "TestApp-Web-Setup-1.1.0.exe",
]
`;
diff --git a/test/src/helpers/runTests.ts b/test/src/helpers/runTests.ts
index e50825d0925..0e238a4dc4e 100755
--- a/test/src/helpers/runTests.ts
+++ b/test/src/helpers/runTests.ts
@@ -92,10 +92,10 @@ async function runTests() {
args.push(...baseForLinuxTests)
}
else if (circleNodeIndex === 2) {
- args.push("snapTest", "nsisUpdaterTest", "linuxArchiveTest")
+ args.push("snapTest", "nsisUpdaterTest")
}
else {
- args.push("windows.*")
+ args.push("windows.*", "linuxArchiveTest")
}
console.log(`Test files for node ${circleNodeIndex}: ${args.join(", ")}`)
}
diff --git a/test/src/windows/nsisTest.ts b/test/src/windows/nsisTest.ts
index 016f45c5801..a47b800f7cb 100644
--- a/test/src/windows/nsisTest.ts
+++ b/test/src/windows/nsisTest.ts
@@ -230,6 +230,7 @@ test.ifDevOrLinuxCi("file associations only perMachine", appThrows(/Please set p
test.ifNotCiMac("web installer", app({
targets: Platform.WINDOWS.createTarget(["nsis-web"], Arch.x64),
config: {
+ compression: process.env.COMPRESSION || "store",
publish: {
provider: "s3",
bucket: "develar",