Skip to content

Commit 4149031

Browse files
committed
fix(deployment): S3 won't upload app files
Close #1331
1 parent 37f84b9 commit 4149031

File tree

17 files changed

+925
-178
lines changed

17 files changed

+925
-178
lines changed

.idea/dictionaries/develar.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/Developer API.md

Lines changed: 114 additions & 19 deletions
Large diffs are not rendered by default.

docs/Publishing Artifacts.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ If `BT_TOKEN` is set and `GH_TOKEN` is not set — defaults to `[{provider: "bin
156156
Amazon S3 options. `https` must be used, so, if you use direct Amazon S3 endpoints, format `https://s3.amazonaws.com/bucket_name` [must be used](http://stackoverflow.com/a/11203685/1910191). And do not forget to make files/directories public.
157157

158158
AWS credentials are required, please see [getting your credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-your-credentials.html).
159-
Define `AWS_SECRET_ACCESS_KEY` and `AWS_ACCESS_KEY_ID` [environment variables](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-environment.html). Or in the [~/.aws/credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html).
159+
Define `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` [environment variables](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-environment.html).
160+
Or in the [~/.aws/credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html).
160161

161162
**Kind**: interface of <code>[electron-builder-http/out/publishOptions](#module_electron-builder-http/out/publishOptions)</code>
162163
**Extends**: <code>[PublishConfiguration](#PublishConfiguration)</code>

jsdoc/helpers.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ function identifierToLink(id, root) {
125125
!id.startsWith("module:http.") &&
126126
!id.startsWith("module:bluebird-lst.") &&
127127
!id.startsWith("module:child_process.") &&
128-
!id.startsWith("module:progress-ex") &&
129128
!id.endsWith(".T") &&
130129
!id.endsWith(".R") &&
131130
!id.endsWith(".K") &&

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"whitespace": "whitespace 'src/**/*.ts'",
1616
"docker-images": "docker/build.sh",
1717
"test-deps-mac": "brew install rpm dpkg mono lzip gnu-tar graphicsmagick xz && brew install wine --without-x11",
18-
"update-deps": "lerna exec -- npm-check-updates --reject 'electron-builder-http,electron-builder-util,electron-builder-core,electron-publish,electron-forge-maker-' -a",
18+
"update-deps": "lerna exec -- npm-check-updates --reject 'electron-builder-http,electron-builder-util,electron-builder-core,electron-publish,electron-forge-maker-appimage,electron-forge-maker-nsis,electron-forge-maker-snap' -a",
1919
"set-versions": "node test/out/helpers/setVersions.js",
2020
"npm-publish": "yarn compile && ./packages/npm-publish.sh && conventional-changelog -p angular -i CHANGELOG.md -s",
2121
"schema": "typescript-json-schema packages/electron-builder/tsconfig.json Config --out packages/electron-builder/scheme.json --noExtraProps --useTypeOfKeyword --strictNullChecks",
@@ -31,7 +31,7 @@
3131
"ajv": "^5.0.4-beta.2",
3232
"ajv-keywords": "^2.0.1-beta.2",
3333
"archiver": "^1.3.0",
34-
"aws-sdk": "^2.36.0",
34+
"aws-sdk": "^2.37.0",
3535
"bluebird-lst": "^1.0.2",
3636
"chalk": "^1.1.3",
3737
"chromium-pickle-js": "^0.2.0",
@@ -52,7 +52,6 @@
5252
"normalize-package-data": "^2.3.6",
5353
"parse-color": "^1.0.0",
5454
"plist": "^2.0.1",
55-
"progress-ex": "^2.0.0",
5655
"sanitize-filename": "^1.6.1",
5756
"semver": "^5.3.0",
5857
"stat-mode": "^0.2.2",

packages/electron-builder-http/src/publishOptions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ export interface GenericServerOptions extends PublishConfiguration {
9292
* Amazon S3 options. `https` must be used, so, if you use direct Amazon S3 endpoints, format `https://s3.amazonaws.com/bucket_name` [must be used](http://stackoverflow.com/a/11203685/1910191). And do not forget to make files/directories public.
9393
*
9494
* AWS credentials are required, please see [getting your credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-your-credentials.html).
95-
* Define `AWS_SECRET_ACCESS_KEY` and `AWS_ACCESS_KEY_ID` [environment variables](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-environment.html). Or in the [~/.aws/credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html).
95+
* Define `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` [environment variables](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-environment.html).
96+
* Or in the [~/.aws/credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html).
9697
*/
9798
export interface S3Options extends PublishConfiguration {
9899
/**

packages/electron-builder/src/targets/dmg.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@ export class DmgTarget extends Target {
168168

169169
// dmg file must not exist otherwise hdiutil failed (https://github.com/electron-userland/electron-builder/issues/1308#issuecomment-282847594), so, -ov must be specified
170170
//noinspection SpellCheckingInspection
171-
await spawn("hdiutil", addVerboseIfNeed(["convert", tempDmg, "-ov", "-format", specification.format!, "-imagekey", `zlib-level=${process.env.ELECTRON_BUILDER_COMPRESSION_LEVEL || "9"}`, "-o", artifactPath]))
171+
const args = ["convert", tempDmg, "-ov", "-format", specification.format!, "-o", artifactPath]
172+
if (specification.format === "UDZO") {
173+
args.push("-imagekey", `zlib-level=${process.env.ELECTRON_BUILDER_COMPRESSION_LEVEL || "9"}`)
174+
}
175+
await spawn("hdiutil", addVerboseIfNeed(args))
172176
await exec("hdiutil", addVerboseIfNeed(["internet-enable", "-no"]).concat(artifactPath))
173177

174178
this.packager.dispatchArtifactCreated(artifactPath, this, arch, `${appInfo.name}-${appInfo.version}.dmg`)

packages/electron-publish/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
"bluebird-lst": "^1.0.2",
1717
"electron-builder-http": "~0.0.0-semantic-release",
1818
"electron-builder-util": "~0.0.0-semantic-release",
19-
"chalk": "^1.1.3",
20-
"progress-ex": "^2.0.0"
19+
"chalk": "^1.1.3"
2120
},
2221
"typings": "./out/electron-publish.d.ts"
2322
}

packages/electron-publish/src/multiProgress.ts

Lines changed: 43 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { setPrinter } from "electron-builder-util/out/log"
2-
import ProgressBar from "progress-ex"
2+
import { ProgressBar } from "./progress"
33

44
export class MultiProgress {
55
private readonly stream = <any>process.stdout
@@ -11,82 +11,58 @@ export class MultiProgress {
1111

1212
private barCount = 0
1313

14-
createBar(format: string, options: any) {
14+
createBar(format: string, options: any): ProgressBar {
1515
options.stream = this.stream
1616

17-
const bar: any = new ProgressBar(format, options)
18-
this.barCount++
19-
let index = -1
17+
const manager = this
18+
class MultiProgressBar extends ProgressBar {
19+
private index = -1
2020

21-
const render = bar.render
22-
bar.render = (tokens: any) => {
23-
if (index === -1) {
24-
index = this.totalLines
25-
this.allocateLines(1)
26-
}
27-
else {
28-
this.moveCursor(index)
21+
constructor(format: string, options: any) {
22+
super(format, options)
2923
}
3024

31-
render.call(bar, tokens)
32-
33-
if (!this.isLogListenerAdded) {
34-
this.isLogListenerAdded = true
35-
setPrinter(message => {
36-
let newLineCount = 0
37-
let newLineIndex = message.indexOf("\n")
38-
while (newLineIndex > -1) {
39-
newLineCount++
40-
newLineIndex = message.indexOf("\n", ++newLineIndex)
41-
}
42-
43-
this.allocateLines(newLineCount + 1)
44-
this.stream.write(message)
45-
})
25+
render() {
26+
if (this.index === -1) {
27+
this.index = manager.totalLines
28+
manager.allocateLines(1)
29+
}
30+
else {
31+
manager.moveCursor(this.index)
32+
}
33+
34+
super.render()
35+
36+
if (!manager.isLogListenerAdded) {
37+
manager.isLogListenerAdded = true
38+
setPrinter(message => {
39+
let newLineCount = 0
40+
let newLineIndex = message.indexOf("\n")
41+
while (newLineIndex > -1) {
42+
newLineCount++
43+
newLineIndex = message.indexOf("\n", ++newLineIndex)
44+
}
45+
46+
manager.allocateLines(newLineCount + 1)
47+
manager.stream.write(message)
48+
})
49+
}
4650
}
47-
}
4851

49-
bar.terminate = () => {
50-
this.barCount--
51-
if (this.barCount === 0 && this.totalLines > 0) {
52-
this.allocateLines(1)
53-
this.totalLines = 0
54-
this.cursor = 0
55-
setPrinter(null)
56-
this.isLogListenerAdded = false
57-
}
58-
}
59-
60-
bar.tick = (len: number, tokens: any) => {
61-
if (len !== 0) {
62-
len = len || 1
63-
}
64-
65-
if (tokens != null) {
66-
bar.tokens = tokens
67-
}
68-
69-
// start time for eta
70-
if (bar.curr == 0) {
71-
bar.start = new Date()
72-
}
73-
74-
bar.curr += len
75-
76-
if (bar.complete) {
77-
return
78-
}
79-
80-
bar.render()
81-
82-
// progress complete
83-
if (bar.curr >= bar.total) {
84-
bar.complete = true
85-
bar.terminate()
86-
bar.callback(this)
52+
terminate() {
53+
manager.barCount--
54+
if (manager.barCount === 0 && manager.totalLines > 0) {
55+
manager.allocateLines(1)
56+
manager.totalLines = 0
57+
manager.cursor = 0
58+
setPrinter(null)
59+
manager.isLogListenerAdded = false
60+
}
8761
}
8862
}
8963

64+
const bar = new MultiProgressBar(format, options)
65+
this.barCount++
9066
return bar
9167
}
9268

0 commit comments

Comments
 (0)