Skip to content

Commit

Permalink
fix(nsis): respect multiLanguageInstaller option
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Jul 26, 2017
1 parent 5169b8b commit 7a5338f
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 24 deletions.
2 changes: 1 addition & 1 deletion docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ Configuration Options
Inherits [NsisOptions](#NsisOptions) options.
* <a name="NsisWebOptions-appPackageUrl"></a>`appPackageUrl` String - 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).
URL like `https://example.com/download/latest` allows web installer to be version independent (installer will download latest application package). Please note — it is [full URL](https://github.com/electron-userland/electron-builder/issues/1810#issuecomment-317650878).

Custom `X-Arch` http header is set to `32` or `64`.
* <a name="NsisWebOptions-artifactName"></a>`artifactName` String - 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}`.
Expand Down
9 changes: 7 additions & 2 deletions docs/api/electron-builder-http.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
* [`.onProgress(progress)`](#module_electron-builder-http.DownloadOptions+onProgress)
* [`.ProgressInfo`](#ProgressInfo)
* [`.RequestHeaders`](#RequestHeaders)
* [`.RequestOptionsEx`](#RequestOptionsEx) ⇐ <code>module:http.RequestOptions</code>
* [`.Response`](#Response) ⇐ <code>internal:EventEmitter</code>
* [`.setEncoding(encoding)`](#module_electron-builder-http.Response+setEncoding)
* [.CancellationError](#CancellationError) ⇐ <code>Error</code>
Expand All @@ -135,7 +136,7 @@
* [`._transform(chunk, encoding, callback)`](#module_electron-builder-http.DigestTransform+_transform)
* [.HttpError](#HttpError) ⇐ <code>Error</code>
* [.HttpExecutor](#HttpExecutor)
* [`.request(options, cancellationToken, data)`](#module_electron-builder-http.HttpExecutor+request) ⇒ <code>Promise&lt;module:electron-builder-http.T&gt;</code>
* [`.request(options, cancellationToken, data)`](#module_electron-builder-http.HttpExecutor+request) ⇒ <code>Promise&lt;String&gt;</code>
* [.Lazy](#Lazy)
* [.ProgressCallbackTransform](#ProgressCallbackTransform) ⇐ <code>internal:Transform</code>
* [`._flush(callback)`](#module_electron-builder-http.ProgressCallbackTransform+_flush)
Expand Down Expand Up @@ -181,6 +182,10 @@
<a name="RequestHeaders"></a>
### `RequestHeaders`
**Kind**: interface of [<code>electron-builder-http</code>](#module_electron-builder-http)
<a name="RequestOptionsEx"></a>
### `RequestOptionsEx` ⇐ <code>module:http.RequestOptions</code>
**Kind**: interface of [<code>electron-builder-http</code>](#module_electron-builder-http)
**Extends**: <code>module:http.RequestOptions</code>
<a name="Response"></a>
### `Response` ⇐ <code>internal:EventEmitter</code>
**Kind**: interface of [<code>electron-builder-http</code>](#module_electron-builder-http)
Expand Down Expand Up @@ -270,7 +275,7 @@
### HttpExecutor
**Kind**: class of [<code>electron-builder-http</code>](#module_electron-builder-http)
<a name="module_electron-builder-http.HttpExecutor+request"></a>
#### `httpExecutor.request(options, cancellationToken, data)` ⇒ <code>Promise&lt;module:electron-builder-http.T&gt;</code>
#### `httpExecutor.request(options, cancellationToken, data)` ⇒ <code>Promise&lt;String&gt;</code>
**Kind**: instance method of [<code>HttpExecutor</code>](#HttpExecutor)

| Param | Type |
Expand Down
4 changes: 0 additions & 4 deletions docs/api/electron-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,6 @@
* [`.isAutoDiscoveryCodeSignIdentity()`](#module_electron-builder/out/util/flags.isAutoDiscoveryCodeSignIdentity) ⇒ <code>Boolean</code>
* [`.isBuildCacheEnabled()`](#module_electron-builder/out/util/flags.isBuildCacheEnabled) ⇒ <code>Boolean</code>
* [`.isUseSystemSigncode()`](#module_electron-builder/out/util/flags.isUseSystemSigncode) ⇒ <code>Boolean</code>
* [`.isUseSystemWine()`](#module_electron-builder/out/util/flags.isUseSystemWine) ⇒ <code>Boolean</code>

<a name="module_electron-builder/out/util/flags.isAutoDiscoveryCodeSignIdentity"></a>
### `electron-builder/out/util/flags.isAutoDiscoveryCodeSignIdentity()` ⇒ <code>Boolean</code>
Expand All @@ -780,9 +779,6 @@
<a name="module_electron-builder/out/util/flags.isUseSystemSigncode"></a>
### `electron-builder/out/util/flags.isUseSystemSigncode()` ⇒ <code>Boolean</code>
**Kind**: method of [<code>electron-builder/out/util/flags</code>](#module_electron-builder/out/util/flags)
<a name="module_electron-builder/out/util/flags.isUseSystemWine"></a>
### `electron-builder/out/util/flags.isUseSystemWine()` ⇒ <code>Boolean</code>
**Kind**: method of [<code>electron-builder/out/util/flags</code>](#module_electron-builder/out/util/flags)
<a name="module_electron-builder/out/util/packageDependencies"></a>
## electron-builder/out/util/packageDependencies
<a name="module_electron-builder/out/util/packageDependencies.createLazyProductionDeps"></a>
Expand Down
5 changes: 3 additions & 2 deletions packages/electron-builder/src/targets/nsis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,11 +462,12 @@ export class NsisTarget extends Target {
return licensePage == null ? "" : createMacro("licensePage", licensePage)
})

taskManager.addTask(addCustomMessageFileInclude("messages.yml", packager, this.isUnicodeEnabled))
const isMultiLang = this.isUnicodeEnabled && this.options.multiLanguageInstaller !== false
taskManager.addTask(addCustomMessageFileInclude("messages.yml", packager, isMultiLang))

if (!this.isPortable) {
if (this.isUnicodeEnabled && this.options.oneClick === false) {
taskManager.addTask(addCustomMessageFileInclude("boringMessages.yml", packager, this.isUnicodeEnabled))
taskManager.addTask(addCustomMessageFileInclude("boringMessages.yml", packager, isMultiLang))
}

taskManager.add(async () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/electron-builder/src/targets/nsis/nsisUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ async function writeCustomLangFile(data: string, packager: PlatformPackager<any>
return file
}

export async function addCustomMessageFileInclude(input: string, packager: PlatformPackager<any>, isUnicodeEnabled: boolean) {
export async function addCustomMessageFileInclude(input: string, packager: PlatformPackager<any>, isMultiLang: boolean) {
const data = safeLoad(await readFile(path.join(nsisTemplatesDir, input), "utf-8"))
if (!isUnicodeEnabled) {
if (!isMultiLang) {
for (const messageId of Object.keys(data)) {
for (const langId of Object.keys(data[messageId])) {
if (langId !== "en") {
Expand All @@ -76,7 +76,7 @@ export async function addCustomMessageFileInclude(input: string, packager: Platf
}
}

const instructions = computeCustomMessageTranslations(data, isUnicodeEnabled).join("\n")
const instructions = computeCustomMessageTranslations(data, isMultiLang).join("\n")
debug(instructions)
return '!include "' + await writeCustomLangFile(instructions, packager) + '"\n'
}
Expand Down
2 changes: 1 addition & 1 deletion test/src/mac/macPackagerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ test.ifMac("one-package", app({
},
}))

test.ifMac("electronDist", appThrows({
test.ifMac.ifAll("electronDist", appThrows({
targets: Platform.MAC.createTarget(DIR_TARGET),
config: {
electronDist: "foo",
Expand Down
23 changes: 12 additions & 11 deletions test/src/windows/installerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test.ifNotCiMac("boring, MUI_HEADER", () => {
oneClick: false,
}
},
effectiveOptionComputed: async(it) => {
effectiveOptionComputed: async it => {
const defines = it[0]
expect(defines.MUI_HEADERIMAGE).toBeNull()
expect(defines.MUI_HEADERIMAGE_BITMAP).toEqual(installerHeaderPath)
Expand All @@ -54,14 +54,14 @@ test.ifNotCiMac("boring, MUI_HEADER", () => {
test.ifAll.ifNotCiMac("boring, MUI_HEADER as option", () => {
let installerHeaderPath: string | null = null
return assertPack("test-app-one", {
targets: Platform.WINDOWS.createTarget(["nsis"], Arch.ia32, Arch.x64),
config: {
nsis: {
oneClick: false,
installerHeader: "foo.bmp"
}
},
effectiveOptionComputed: async (it) => {
targets: Platform.WINDOWS.createTarget(["nsis"], Arch.ia32, Arch.x64),
config: {
nsis: {
oneClick: false,
installerHeader: "foo.bmp"
}
},
effectiveOptionComputed: async it => {
const defines = it[0]
expect(defines.MUI_HEADERIMAGE).toBeNull()
expect(defines.MUI_HEADERIMAGE_BITMAP).toEqual(installerHeaderPath)
Expand Down Expand Up @@ -100,13 +100,14 @@ test.ifAll.ifNotCiMac("allowToChangeInstallationDirectory", app({
nsis: {
allowToChangeInstallationDirectory: true,
oneClick: false,
multiLanguageInstaller: false,
}
},
}, {
projectDirCreated: async (projectDir) => {
projectDirCreated: async projectDir => {
await writeFile(path.join(projectDir, "build", "release-notes.md"), "New release with new bugs and\n\nwithout features")
},
packed: async(context) => {
packed: async context => {
await expectUpdateMetadata(context, archFromString(process.arch))
const updateInfo = safeLoad(await readFile(path.join(context.outDir, "latest.yml"), "utf-8"))
expect(updateInfo.sha512).not.toEqual("")
Expand Down

0 comments on commit 7a5338f

Please sign in to comment.