Skip to content

Commit

Permalink
fix(deployment): S3 won't upload app files
Browse files Browse the repository at this point in the history
Close #1331
  • Loading branch information
develar committed Apr 4, 2017
1 parent 37f84b9 commit 4149031
Show file tree
Hide file tree
Showing 17 changed files with 925 additions and 178 deletions.
1 change: 1 addition & 0 deletions .idea/dictionaries/develar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

133 changes: 114 additions & 19 deletions docs/Developer API.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion docs/Publishing Artifacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ If `BT_TOKEN` is set and `GH_TOKEN` is not set — defaults to `[{provider: "bin
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.

AWS credentials are required, please see [getting your credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-your-credentials.html).
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).
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).
Or in the [~/.aws/credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html).

**Kind**: interface of <code>[electron-builder-http/out/publishOptions](#module_electron-builder-http/out/publishOptions)</code>
**Extends**: <code>[PublishConfiguration](#PublishConfiguration)</code>
Expand Down
1 change: 0 additions & 1 deletion jsdoc/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ function identifierToLink(id, root) {
!id.startsWith("module:http.") &&
!id.startsWith("module:bluebird-lst.") &&
!id.startsWith("module:child_process.") &&
!id.startsWith("module:progress-ex") &&
!id.endsWith(".T") &&
!id.endsWith(".R") &&
!id.endsWith(".K") &&
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"whitespace": "whitespace 'src/**/*.ts'",
"docker-images": "docker/build.sh",
"test-deps-mac": "brew install rpm dpkg mono lzip gnu-tar graphicsmagick xz && brew install wine --without-x11",
"update-deps": "lerna exec -- npm-check-updates --reject 'electron-builder-http,electron-builder-util,electron-builder-core,electron-publish,electron-forge-maker-' -a",
"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",
"set-versions": "node test/out/helpers/setVersions.js",
"npm-publish": "yarn compile && ./packages/npm-publish.sh && conventional-changelog -p angular -i CHANGELOG.md -s",
"schema": "typescript-json-schema packages/electron-builder/tsconfig.json Config --out packages/electron-builder/scheme.json --noExtraProps --useTypeOfKeyword --strictNullChecks",
Expand All @@ -31,7 +31,7 @@
"ajv": "^5.0.4-beta.2",
"ajv-keywords": "^2.0.1-beta.2",
"archiver": "^1.3.0",
"aws-sdk": "^2.36.0",
"aws-sdk": "^2.37.0",
"bluebird-lst": "^1.0.2",
"chalk": "^1.1.3",
"chromium-pickle-js": "^0.2.0",
Expand All @@ -52,7 +52,6 @@
"normalize-package-data": "^2.3.6",
"parse-color": "^1.0.0",
"plist": "^2.0.1",
"progress-ex": "^2.0.0",
"sanitize-filename": "^1.6.1",
"semver": "^5.3.0",
"stat-mode": "^0.2.2",
Expand Down
3 changes: 2 additions & 1 deletion packages/electron-builder-http/src/publishOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ export interface GenericServerOptions extends PublishConfiguration {
* 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.
*
* AWS credentials are required, please see [getting your credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-your-credentials.html).
* 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).
* 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).
* Or in the [~/.aws/credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html).
*/
export interface S3Options extends PublishConfiguration {
/**
Expand Down
6 changes: 5 additions & 1 deletion packages/electron-builder/src/targets/dmg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ export class DmgTarget extends Target {

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

this.packager.dispatchArtifactCreated(artifactPath, this, arch, `${appInfo.name}-${appInfo.version}.dmg`)
Expand Down
3 changes: 1 addition & 2 deletions packages/electron-publish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
"bluebird-lst": "^1.0.2",
"electron-builder-http": "~0.0.0-semantic-release",
"electron-builder-util": "~0.0.0-semantic-release",
"chalk": "^1.1.3",
"progress-ex": "^2.0.0"
"chalk": "^1.1.3"
},
"typings": "./out/electron-publish.d.ts"
}
110 changes: 43 additions & 67 deletions packages/electron-publish/src/multiProgress.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { setPrinter } from "electron-builder-util/out/log"
import ProgressBar from "progress-ex"
import { ProgressBar } from "./progress"

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

private barCount = 0

createBar(format: string, options: any) {
createBar(format: string, options: any): ProgressBar {
options.stream = this.stream

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

const render = bar.render
bar.render = (tokens: any) => {
if (index === -1) {
index = this.totalLines
this.allocateLines(1)
}
else {
this.moveCursor(index)
constructor(format: string, options: any) {
super(format, options)
}

render.call(bar, tokens)

if (!this.isLogListenerAdded) {
this.isLogListenerAdded = true
setPrinter(message => {
let newLineCount = 0
let newLineIndex = message.indexOf("\n")
while (newLineIndex > -1) {
newLineCount++
newLineIndex = message.indexOf("\n", ++newLineIndex)
}

this.allocateLines(newLineCount + 1)
this.stream.write(message)
})
render() {
if (this.index === -1) {
this.index = manager.totalLines
manager.allocateLines(1)
}
else {
manager.moveCursor(this.index)
}

super.render()

if (!manager.isLogListenerAdded) {
manager.isLogListenerAdded = true
setPrinter(message => {
let newLineCount = 0
let newLineIndex = message.indexOf("\n")
while (newLineIndex > -1) {
newLineCount++
newLineIndex = message.indexOf("\n", ++newLineIndex)
}

manager.allocateLines(newLineCount + 1)
manager.stream.write(message)
})
}
}
}

bar.terminate = () => {
this.barCount--
if (this.barCount === 0 && this.totalLines > 0) {
this.allocateLines(1)
this.totalLines = 0
this.cursor = 0
setPrinter(null)
this.isLogListenerAdded = false
}
}

bar.tick = (len: number, tokens: any) => {
if (len !== 0) {
len = len || 1
}

if (tokens != null) {
bar.tokens = tokens
}

// start time for eta
if (bar.curr == 0) {
bar.start = new Date()
}

bar.curr += len

if (bar.complete) {
return
}

bar.render()

// progress complete
if (bar.curr >= bar.total) {
bar.complete = true
bar.terminate()
bar.callback(this)
terminate() {
manager.barCount--
if (manager.barCount === 0 && manager.totalLines > 0) {
manager.allocateLines(1)
manager.totalLines = 0
manager.cursor = 0
setPrinter(null)
manager.isLogListenerAdded = false
}
}
}

const bar = new MultiProgressBar(format, options)
this.barCount++
return bar
}

Expand Down
Loading

0 comments on commit 4149031

Please sign in to comment.