Skip to content

Commit

Permalink
perf(electron-updater): a little bit more compact blockmap data
Browse files Browse the repository at this point in the history
Doesn't make a lot of sense since in any case deflated, but anyway
  • Loading branch information
develar committed Oct 13, 2017
1 parent 586140d commit c92bc38
Show file tree
Hide file tree
Showing 14 changed files with 203 additions and 176 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
"////": "All typings are added into root `package.json` to avoid duplication errors in the IDE compiler (several `node.d.ts` files).",
"dependencies": {
"7zip-bin": "^2.2.7",
"archiver": "^2.0.3",
"archiver": "^2.1.0",
"async-exit-hook": "^2.0.1",
"aws-sdk": "^2.132.0",
"aws-sdk": "^2.133.0",
"bluebird-lst": "^1.0.4",
"chalk": "^2.1.0",
"chromium-pickle-js": "^0.2.0",
Expand Down Expand Up @@ -112,7 +112,7 @@
"ts-babel": "^4.1.6",
"ts-jsdoc": "^2.0.6",
"tslint": "^5.7.0",
"typescript": "^2.5.3",
"typescript": "^2.6.0-rc",
"v8-compile-cache": "^1.1.0",
"whitespace": "^2.1.0",
"worker-farm": "^1.5.0",
Expand Down
6 changes: 5 additions & 1 deletion packages/app-package-builder/src/blockMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ export async function createDifferentialPackage(archiveFile: string): Promise<Pa
}

async function appendBlockMapData(blockMap: BlockMap, archiveFile: string, fd: number, headerSize: number | null, addLength: boolean) {
const blockMapDataString = safeDump(blockMap)
// lzma doesn't make a lof of sense (151 KB lzma vs 156 KB deflate) for small text file where most of the data are unique strings (encoded sha256 checksums)
const blockMapDataString = safeDump(blockMap, {
indent: 0,
flowLevel: 0,
})
const blockMapFileData = await deflateRaw(blockMapDataString, {level: 9})

await write(fd, blockMapFileData)
Expand Down
2 changes: 1 addition & 1 deletion packages/builder-util-runtime/src/CancellationToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class CancellationToken extends EventEmitter {
}
}

createPromise<R>(callback: (resolve: (thenableOrResult?: R) => void, reject: (error?: Error) => void, onCancel: (callback: () => void) => void) => void): Promise<R> {
createPromise<R>(callback: (resolve: (thenableOrResult?: R) => void, reject: (error: Error) => void, onCancel: (callback: () => void) => void) => void): Promise<R> {
if (this.cancelled) {
return BluebirdPromise.reject<R>(new CancellationError())
}
Expand Down
2 changes: 1 addition & 1 deletion packages/builder-util-runtime/src/httpExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export abstract class HttpExecutor<REQUEST> {
})
}

addErrorAndTimeoutHandlers(request: any, reject: (error?: Error | null) => void) {
addErrorAndTimeoutHandlers(request: any, reject: (error: Error) => void) {
this.addTimeOutHandler(request, reject)
request.on("error", reject)
request.on("aborted", () => {
Expand Down
2 changes: 0 additions & 2 deletions packages/builder-util-runtime/src/uuid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export class UUID {
private ascii: string | null
private binary: Buffer
private version: number
private variant: string

// from rfc4122#appendix-C
static readonly DNS = new UUID("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
Expand All @@ -55,7 +54,6 @@ export class UUID {
}

this.version = check.version!!
this.variant = check.variant!!

if (check.format === "ascii") {
this.ascii = uuid as string
Expand Down
2 changes: 1 addition & 1 deletion packages/builder-util/src/nodeHttpExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class NodeHttpExecutor extends HttpExecutor<ClientRequest> {
this.doDownload(configureRequestOptionsFromUrl(url, {
headers: options.headers || undefined,
agent,
}), destination, 0, options, (error: Error) => {
}), destination, 0, options, error => {
if (error == null) {
resolve(destination)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder-squirrel-windows/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"builder-util": "^0.0.0-semantic-release",
"bluebird-lst": "^1.0.4",
"fs-extra-p": "^4.4.4",
"archiver": "^2.0.3",
"archiver": "^2.1.0",
"sanitize-filename": "^1.6.1"
},
"peerDependencies": {
Expand Down
6 changes: 4 additions & 2 deletions packages/electron-builder/src/targets/appx.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import BluebirdPromise from "bluebird-lst"
import { Arch, asArray, use, log, debug } from "builder-util"
import { Arch, asArray, log, debug } from "builder-util"
import { walk, copyOrLinkFile } from "builder-util/out/fs"
import { emptyDir, readdir, readFile, remove, writeFile } from "fs-extra-p"
import * as path from "path"
Expand Down Expand Up @@ -105,7 +105,9 @@ export default class AppXTarget extends Target {
await writeFile(mappingFile, mapping)
packager.debugLogger.add("appx.mapping", mapping)

use(this.options.makeappxArgs, (it: Array<string>) => makeAppXArgs.push(...it))
if (this.options.makeappxArgs != null) {
makeAppXArgs.push(...this.options.makeappxArgs)
}
await vm.exec(vm.toVmFile(path.join(vendorPath, "windows-10", Arch[arch], "makeappx.exe")), makeAppXArgs)
await packager.sign(artifactPath)

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.4.4",
"aws-sdk": "^2.132.0",
"aws-sdk": "^2.133.0",
"mime": "^2.0.3",
"electron-publish": "~0.0.0-semantic-release",
"builder-util": "^0.0.0-semantic-release",
Expand Down
6 changes: 6 additions & 0 deletions packages/electron-updater/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 2.12.0

### Features

* [Linux auto-update](https://github.com/electron-userland/electron-builder/releases/tag/v19.37.0)

# 2.11.0

### Features
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-updater/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"js-yaml": "^3.10.0",
"semver": "^5.4.1",
"source-map-support": "^0.5.0",
"builder-util-runtime": "^0.0.0-semantic-release",
"builder-util-runtime": "~0.0.0-semantic-release",
"electron-is-dev": "^0.3.0",
"xelement": "^1.0.16",
"lodash.isequal": "^4.5.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-updater/src/electronHttpExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class ElectronHttpExecutor extends HttpExecutor<Electron.ClientRequest> {
return await options.cancellationToken.createPromise<string>((resolve, reject, onCancel) => {
this.doDownload(configureRequestOptionsFromUrl(url, {
headers: options.headers || undefined,
}), destination, 0, options, (error: Error) => {
}), destination, 0, options, error => {
if (error == null) {
resolve(destination)
}
Expand Down
Loading

0 comments on commit c92bc38

Please sign in to comment.