-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
142 changed files
with
424 additions
and
335 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/electron-builder-util/package.json → packages/builder-util/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/electron-builder-util/readme.md → packages/builder-util/readme.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# electron-builder-util | ||
# builder-util | ||
|
||
Part of [electron-builder](https://github.com/electron-userland/electron-builder). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export interface PackageBuilder { | ||
readonly buildResourcesDir: string | ||
|
||
readonly resourceList: Promise<Array<string>> | ||
|
||
getTempFile(suffix: string): Promise<string> | ||
} |
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...tron-builder/src/util/asyncTaskManager.ts → ...ages/builder-util/src/asyncTaskManager.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "dmg-builder", | ||
"version": "0.0.0-semantic-release", | ||
"main": "out/httpExecutor.js", | ||
"author": "Vladimir Krivosheev", | ||
"license": "MIT", | ||
"repository": "electron-userland/electron-builder", | ||
"bugs": "https://github.com/electron-userland/electron-builder/issues", | ||
"homepage": "https://github.com/electron-userland/electron-builder", | ||
"files": [ | ||
"out" | ||
], | ||
"dependencies": { | ||
"fs-extra-p": "^4.4.0", | ||
"bluebird-lst": "^1.0.3", | ||
"iconv-lite": "^0.4.18", | ||
"parse-color": "^1.0.0", | ||
"builder-util": "^0.0.0-semantic-release" | ||
}, | ||
"typings": "./out/dmg.d.ts" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# electron-builder-http | ||
|
||
Part of [electron-builder](https://github.com/electron-userland/electron-builder). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import BluebirdPromise from "bluebird-lst" | ||
import { exec } from "builder-util" | ||
import { PackageBuilder } from "builder-util/out/api" | ||
import { AsyncTaskManager } from "builder-util/out/asyncTaskManager" | ||
import { executeFinally } from "builder-util/out/promise" | ||
import { outputFile, readFile } from "fs-extra-p" | ||
import * as path from "path" | ||
|
||
const root = path.join(__dirname, "..") | ||
|
||
export function getDmgTemplatePath() { | ||
return path.join(root, "templates") | ||
} | ||
|
||
export function getDmgVendorPath() { | ||
return path.join(root, "vendor") | ||
} | ||
|
||
export async function attachAndExecute(dmgPath: string, readWrite: boolean, task: () => Promise<any>) { | ||
//noinspection SpellCheckingInspection | ||
const args = ["attach", "-noverify", "-noautoopen"] | ||
if (readWrite) { | ||
args.push("-readwrite") | ||
} | ||
|
||
args.push(dmgPath) | ||
const attachResult = await exec("hdiutil", args, {maxBuffer: 2 * 1024 * 1024}) | ||
const deviceResult = attachResult == null ? null : /^(\/dev\/\w+)/.exec(attachResult) | ||
const device = deviceResult == null || deviceResult.length !== 2 ? null : deviceResult[1] | ||
if (device == null) { | ||
throw new Error(`Cannot mount: ${attachResult}`) | ||
} | ||
|
||
return await executeFinally(task(), () => detach(device)) | ||
} | ||
|
||
export async function detach(name: string) { | ||
try { | ||
await exec("hdiutil", ["detach", name]) | ||
} | ||
catch (e) { | ||
await new BluebirdPromise((resolve, reject) => { | ||
setTimeout(() => { | ||
exec("hdiutil", ["detach", "-force", name]) | ||
.then(resolve) | ||
.catch(reject) | ||
}, 1000) | ||
}) | ||
} | ||
} | ||
|
||
export function computeBackgroundColor(rawValue: string) { | ||
return require("parse-color")(rawValue).hex | ||
} | ||
|
||
export async function computeBackground(packager: PackageBuilder) { | ||
const resourceList = await packager.resourceList | ||
if (resourceList.includes("background.tiff")) { | ||
return path.join(packager.buildResourcesDir, "background.tiff") | ||
} | ||
else if (resourceList.includes("background.png")) { | ||
return path.join(packager.buildResourcesDir, "background.png") | ||
} | ||
else { | ||
return path.join(getDmgTemplatePath(), "background.tiff") | ||
} | ||
} | ||
|
||
export async function applyProperties(entries: any, env: any, asyncTaskManager: AsyncTaskManager, packager: PackageBuilder) { | ||
const dmgPropertiesFile = await packager.getTempFile("dmgProperties.pl") | ||
|
||
asyncTaskManager.addTask(outputFile(dmgPropertiesFile, (await readFile(path.join(getDmgTemplatePath(), "dmgProperties.pl"), "utf-8")).replace("$ENTRIES", entries))) | ||
|
||
await asyncTaskManager.awaitTasks() | ||
|
||
await exec("/usr/bin/perl", [dmgPropertiesFile], { | ||
cwd: getDmgVendorPath(), | ||
env | ||
}) | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../tsconfig-base.json", | ||
"compilerOptions": { | ||
"outDir": "out" | ||
}, | ||
"include": [ | ||
"src/**/*.ts" | ||
] | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,5 @@ | |
}, | ||
"include": [ | ||
"src/**/*.ts" | ||
], | ||
"files": [ | ||
"../../typings/debug.d.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/electron-builder-squirrel-windows/src/squirrelPack.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.