Skip to content

Commit

Permalink
fix(windows): use build number env only if numeric
Browse files Browse the repository at this point in the history
Close #2635
  • Loading branch information
develar committed Mar 9, 2018
1 parent 0edb668 commit 7532142
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 27 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@
"app-builder-bin": "1.7.2",
"archiver": "^2.1.1",
"async-exit-hook": "^2.0.1",
"aws-sdk": "^2.205.0",
"aws-sdk": "^2.207.0",
"bluebird-lst": "^1.0.5",
"chalk": "^2.3.2",
"chromium-pickle-js": "^0.2.0",
"debug": "^3.1.0",
"ejs": "^2.5.7",
"electron-download-tf": "4.3.4",
"electron-is-dev": "^0.3.0",
"electron-osx-sign": "0.4.8",
"electron-osx-sign": "0.4.10",
"fs-extra-p": "^4.5.2",
"gitbook-plugin-footer": "^0.0.6",
"hosted-git-info": "^2.5.0",
"hosted-git-info": "^2.6.0",
"iconv-lite": "^0.4.19",
"ini": "^1.3.5",
"is-ci": "^1.1.0",
Expand Down Expand Up @@ -105,7 +105,7 @@
"typescript": "2.7.2",
"v8-compile-cache": "^1.1.2",
"whitespace": "^2.1.0",
"worker-farm": "^1.5.4"
"worker-farm": "^1.6.0"
},
"jest": {
"testEnvironment": "node",
Expand Down
4 changes: 2 additions & 2 deletions packages/electron-builder-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
"chromium-pickle-js": "^0.2.0",
"builder-util-runtime": "0.0.0-semantic-release",
"builder-util": "0.0.0-semantic-release",
"electron-osx-sign": "0.4.8",
"electron-osx-sign": "0.4.10",
"electron-publish": "0.0.0-semantic-release",
"fs-extra-p": "^4.5.2",
"hosted-git-info": "^2.5.0",
"hosted-git-info": "^2.6.0",
"is-ci": "^1.1.0",
"isbinaryfile": "^3.0.2",
"js-yaml": "^3.11.0",
Expand Down
7 changes: 6 additions & 1 deletion packages/electron-builder-lib/src/appInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ export class AppInfo {

get versionInWeirdWindowsForm(): string {
const parsedVersion = new SemVer(this.version)
return `${parsedVersion.major}.${parsedVersion.minor}.${parsedVersion.patch}.${this.buildNumber || "0"}`
// https://github.com/electron-userland/electron-builder/issues/2635#issuecomment-371792272
let buildNumber = this.buildNumber
if (buildNumber == null || !/^\d+$/.test(buildNumber)) {
buildNumber = "0"
}
return `${parsedVersion.major}.${parsedVersion.minor}.${parsedVersion.patch}.${buildNumber}`
}

private get notNullDevMetadata() {
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-publisher-s3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"dependencies": {
"fs-extra-p": "^4.5.2",
"aws-sdk": "^2.205.0",
"aws-sdk": "^2.207.0",
"mime": "^2.2.0",
"electron-publish": "~0.0.0-semantic-release",
"builder-util": "^0.0.0-semantic-release",
Expand Down
11 changes: 5 additions & 6 deletions test/src/windows/oneClickInstallerTest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import BluebirdPromise from "bluebird-lst"
import { Arch, Platform } from "electron-builder"
import { writeFile } from "fs-extra-p"
import * as path from "path"
Expand Down Expand Up @@ -41,7 +40,7 @@ test.ifAll.ifNotCiMac("multi language license", app({
},
}, {
projectDirCreated: projectDir => {
return BluebirdPromise.all([
return Promise.all([
writeFile(path.join(projectDir, "build", "license_en.txt"), "Hi"),
writeFile(path.join(projectDir, "build", "license_ru.txt"), "Привет"),
writeFile(path.join(projectDir, "build", "license_ko.txt"), "Привет"),
Expand All @@ -61,7 +60,7 @@ test.ifAll.ifNotCiMac("html license", app({
},
}, {
projectDirCreated: projectDir => {
return BluebirdPromise.all([
return Promise.all([
writeFile(path.join(projectDir, "build", "license.html"), '<html><body><p>Hi <a href="https://google.com" target="_blank">google</a></p></body></html>'),
])
},
Expand Down Expand Up @@ -93,7 +92,7 @@ test.ifDevOrLinuxCi("perMachine, no run after finish", app({
},
}, {
projectDirCreated: projectDir => {
return BluebirdPromise.all([
return Promise.all([
copyTestAsset("headerIcon.ico", path.join(projectDir, "build", "foo test space.ico")),
copyTestAsset("license.txt", path.join(projectDir, "build", "license.txt")),
])
Expand All @@ -117,15 +116,15 @@ test.ifNotCiMac("installerHeaderIcon", () => {
}, {
projectDirCreated: projectDir => {
headerIconPath = path.join(projectDir, "build", "installerHeaderIcon.ico")
return BluebirdPromise.all([copyTestAsset("headerIcon.ico", headerIconPath), copyTestAsset("headerIcon.ico", path.join(projectDir, "build", "uninstallerIcon.ico"))])
return Promise.all([copyTestAsset("headerIcon.ico", headerIconPath), copyTestAsset("headerIcon.ico", path.join(projectDir, "build", "uninstallerIcon.ico"))])
}
}
)
})

test.ifDevOrLinuxCi("custom include", () => assertPack("test-app-one", {targets: nsisTarget}, {
projectDirCreated: projectDir => copyTestAsset("installer.nsh", path.join(projectDir, "build", "installer.nsh")),
packed: context => BluebirdPromise.all([
packed: context => Promise.all([
assertThat(path.join(context.projectDir, "build", "customHeader")).isFile(),
assertThat(path.join(context.projectDir, "build", "customInit")).isFile(),
assertThat(path.join(context.projectDir, "build", "customInstall")).isFile(),
Expand Down
2 changes: 1 addition & 1 deletion test/src/windows/portableTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test.ifAll.ifNotCiMac("portable", app({
}
}))

test.ifAll.ifWinCi("portable zip", app({
test.ifAll.ifDevOrWinCi("portable zip", app({
targets: Platform.WINDOWS.createTarget("portable"),
config: {
publish: null,
Expand Down
27 changes: 15 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,9 @@ atob@^2.0.0:
version "2.0.3"
resolved "https://registry.yarnpkg.com/atob/-/atob-2.0.3.tgz#19c7a760473774468f20b2d2d03372ad7d4cbf5d"

aws-sdk@^2.205.0:
version "2.205.0"
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.205.0.tgz#1a93730253e2be027a4bd3af9248cbda0573de80"
aws-sdk@^2.207.0:
version "2.207.0"
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.207.0.tgz#c0a30977d8d2788301850b265ff05eb7c9fdf7f2"
dependencies:
buffer "4.9.1"
events "^1.1.1"
Expand Down Expand Up @@ -1690,9 +1690,9 @@ electron-is-dev@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/electron-is-dev/-/electron-is-dev-0.3.0.tgz#14e6fda5c68e9e4ecbeff9ccf037cbd7c05c5afe"

[email protected].8:
version "0.4.8"
resolved "https://registry.yarnpkg.com/electron-osx-sign/-/electron-osx-sign-0.4.8.tgz#f0b9fadded9e1e54ec35fa89877b5c6c34c7bc40"
[email protected].10:
version "0.4.10"
resolved "https://registry.yarnpkg.com/electron-osx-sign/-/electron-osx-sign-0.4.10.tgz#be4f3b89b2a75a1dc5f1e7249081ab2929ca3a26"
dependencies:
bluebird "^3.5.0"
compare-version "^0.1.2"
Expand Down Expand Up @@ -2505,10 +2505,14 @@ home-or-tmp@^2.0.0:
os-homedir "^1.0.0"
os-tmpdir "^1.0.1"

hosted-git-info@^2.1.4, hosted-git-info@^2.5.0:
hosted-git-info@^2.1.4:
version "2.5.0"
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.5.0.tgz#6d60e34b3abbc8313062c3b798ef8d901a07af3c"

hosted-git-info@^2.6.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.6.0.tgz#23235b29ab230c576aab0d4f13fc046b0b038222"

html-encoding-sniffer@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz#e70d84b94da53aa375e11fe3a351be6642ca46f8"
Expand Down Expand Up @@ -5796,12 +5800,11 @@ wordwrapjs@^3.0.0:
reduce-flatten "^1.0.1"
typical "^2.6.1"

worker-farm@^1.5.4:
version "1.5.4"
resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.5.4.tgz#4debbe46b40edefcc717ebde74a90b1ae1e909a1"
worker-farm@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.6.0.tgz#aecc405976fab5a95526180846f0dba288f3a4a0"
dependencies:
errno "~0.1.7"
xtend "~4.0.1"

wrap-ansi@^2.0.0:
version "2.1.0"
Expand Down Expand Up @@ -5874,7 +5877,7 @@ xmlhttprequest@~1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.7.0.tgz#dc697a8df0258afacad526c1c296b1bdd12c4ab3"

"xtend@>=4.0.0 <4.1.0-0", xtend@^4.0.0, xtend@~4.0.0, xtend@~4.0.1:
"xtend@>=4.0.0 <4.1.0-0", xtend@^4.0.0, xtend@~4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"

Expand Down

0 comments on commit 7532142

Please sign in to comment.