diff --git a/.idea/electron-builder.iml b/.idea/electron-builder.iml
index cdea3c1d2d5..81b7e41308e 100644
--- a/.idea/electron-builder.iml
+++ b/.idea/electron-builder.iml
@@ -26,6 +26,7 @@
+
diff --git a/README.md b/README.md
index 525b4f5d38a..9a3d01e0964 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ A complete solution to package and build a ready for distribution Electron app f
| Question | Answer |
|--------|-------|
| “I want to configure electron-builder” | [See options](https://github.com/electron-userland/electron-builder/wiki/Options) |
-| “I have a question” | [Open an issue](https://github.com/electron-userland/electron-builder/issues) or [join the chat](http://electron-builder-slack.herokuapp.com) |
+| “I have a question” | [Open an issue](https://github.com/electron-userland/electron-builder/issues) or [join the chat](https://slackin.electron.build) |
| “I found a bug” | [Open an issue](https://github.com/electron-userland/electron-builder/issues/new) |
| “I want to donate” | [Donate with Donorbox](https://donorbox.org/electron-builder) or [Paypal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W6V79R2RGCCHL) |
@@ -172,7 +172,7 @@ and other distributable formats.
## Community
-[electron-builder](http://electron-builder-slack.herokuapp.com) on Slack (please use [threads](https://get.slack.help/hc/en-us/articles/115000769927-Message-threads)).
+[electron-builder](https://slackin.electron.build) on Slack (please use [threads](https://get.slack.help/hc/en-us/articles/115000769927-Message-threads)).
Public [archive](http://electron-builder.slackarchive.io) without registration.
## Further Reading
diff --git a/docs/api/electron-builder-util.md b/docs/api/electron-builder-util.md
index 85390f97d3f..a28c3a4c6e7 100644
--- a/docs/api/electron-builder-util.md
+++ b/docs/api/electron-builder-util.md
@@ -94,6 +94,12 @@
### FileCopier
**Kind**: class of [electron-builder-util/out/fs
](#module_electron-builder-util/out/fs)
+**Properties**
+
+| Name | Type |
+| --- | --- |
+| **isUseHardLink**| Boolean
|
+
#### `fileCopier.copy(src, dest, stat)` ⇒ Promise<void>
@@ -117,8 +123,8 @@ Hard links is used if supported and allowed.
| --- | --- |
| src | String
|
| destination | String
|
-| filter | module:electron-builder-util/out/fs.__type
|
-| transformer | module:electron-builder-util/out/fs.__type
|
+| filter | module:electron-builder-util/out/fs.__type
\| null
|
+| transformer | module:electron-builder-util/out/fs.__type
\| null
|
| isUseHardLink | callback
|
diff --git a/package.json b/package.json
index 685d90674d8..b19165d137b 100644
--- a/package.json
+++ b/package.json
@@ -18,7 +18,7 @@
"update-deps": "node ./packages/update-deps.js",
"set-versions": "node test/out/helpers/setVersions.js",
"npm-publish": "yarn set-versions && 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 --titles",
+ "schema": "typescript-json-schema packages/electron-builder/tsconfig.json Config --out packages/electron-builder/scheme.json --noExtraProps --useTypeOfKeyword --strictNullChecks --titles --required",
"jsdoc": "ts2jsdoc packages/electron-builder-http packages/electron-updater packages/electron-builder-util packages/electron-builder packages/electron-builder-core packages/electron-publish",
"jsdoc2md": "node packages/jsdoc2md.js",
"api": "node ./test/vendor/yarn.js jsdoc && node ./test/vendor/yarn.js jsdoc2md"
@@ -58,7 +58,7 @@
"sanitize-filename": "^1.6.1",
"semver": "^5.3.0",
"stat-mode": "^0.2.2",
- "ts-jsdoc": "^2.0.0",
+ "ts-jsdoc": "^2.0.2",
"tunnel-agent": "^0.6.0",
"update-notifier": "^2.2.0",
"uuid-1345": "^0.99.6",
@@ -81,7 +81,7 @@
"convert-source-map": "^1.5.0",
"decompress-zip": "^0.3.0",
"depcheck": "^0.6.7",
- "develar-typescript-json-schema": "0.11.0",
+ "develar-typescript-json-schema": "0.13.3",
"env-paths": "^1.0.0",
"globby": "^6.1.0",
"jest-cli": "^20.0.4",
diff --git a/packages/electron-builder-util/src/fs.ts b/packages/electron-builder-util/src/fs.ts
index fb93f9d4c51..50a72960f00 100644
--- a/packages/electron-builder-util/src/fs.ts
+++ b/packages/electron-builder-util/src/fs.ts
@@ -159,9 +159,10 @@ export function copyOrLinkFile(src: string, dest: string, stats?: Stats | null,
}
export class FileCopier {
- private isUseHardLink = _isUseHardLink
+ isUseHardLink: boolean
- constructor(private readonly isUseHardLinkFunction?: (file: string) => boolean, private readonly transformer?: FileTransformer) {
+ constructor(private readonly isUseHardLinkFunction?: (file: string) => boolean, private readonly transformer?: FileTransformer | null) {
+ this.isUseHardLink = _isUseHardLink && isUseHardLinkFunction !== DO_NOT_USE_HARD_LINKS
}
async copy(src: string, dest: string, stat: Stats | undefined) {
@@ -203,13 +204,14 @@ export class FileCopier {
* Empty directories is never created.
* Hard links is used if supported and allowed.
*/
-export function copyDir(src: string, destination: string, filter?: Filter, transformer?: FileTransformer, isUseHardLink?: (file: string) => boolean): Promise {
+export function copyDir(src: string, destination: string, filter?: Filter | null, transformer?: FileTransformer | null, isUseHardLink?: (file: string) => boolean): Promise {
+ const fileCopier = new FileCopier(isUseHardLink, transformer)
+
if (debug.enabled) {
- debug(`Copying ${src} to ${destination}${_isUseHardLink ? " using hard links" : ""}`)
+ debug(`Copying ${src} to ${destination}${fileCopier.isUseHardLink ? " using hard links" : ""}`)
}
const createdSourceDirs = new Set()
- const fileCopier = new FileCopier(isUseHardLink, transformer)
const links: Array = []
return walk(src, filter, async(file, stat, parent) => {
if (!stat.isFile() && !stat.isSymbolicLink()) {
@@ -232,6 +234,8 @@ export function copyDir(src: string, destination: string, filter?: Filter, trans
.then(() => BluebirdPromise.map(links, it => symlink(it.link, it.file), CONCURRENCY))
}
+export const DO_NOT_USE_HARD_LINKS = (file: string) => false
+
interface Link {
readonly link: string,
readonly file: string
diff --git a/packages/electron-builder/src/asar.ts b/packages/electron-builder/src/asar.ts
index 07023eb31bd..40e43a8cfa3 100644
--- a/packages/electron-builder/src/asar.ts
+++ b/packages/electron-builder/src/asar.ts
@@ -4,6 +4,7 @@ import * as path from "path"
const UINT64 = require("cuint").UINT64
+/** @internal */
export class Node {
// we don't use Map because later it will be stringified
files?: { [key: string]: Node }
@@ -18,6 +19,7 @@ export class Node {
link?: string
}
+/** @internal */
export class AsarFilesystem {
private offset = UINT64(0)
diff --git a/packages/electron-builder/src/asarUtil.ts b/packages/electron-builder/src/asarUtil.ts
index 3ad59e8b43c..612daff447b 100644
--- a/packages/electron-builder/src/asarUtil.ts
+++ b/packages/electron-builder/src/asarUtil.ts
@@ -43,6 +43,7 @@ function writeUnpackedFiles(filesToUnpack: Array, fileCopier:
})
}
+/** @internal */
export class AsarPackager {
private readonly fs = new AsarFilesystem(this.src)
private readonly outFile: string
@@ -391,6 +392,7 @@ export class AsarPackager {
}
}
+/** @internal */
export async function checkFileInArchive(asarFile: string, relativeFile: string, messagePrefix: string) {
function error(text: string) {
return new Error(`${messagePrefix} "${relativeFile}" in the "${asarFile}" ${text}`)
diff --git a/packages/electron-builder/src/cli/install-app-deps.ts b/packages/electron-builder/src/cli/install-app-deps.ts
index 1e20af8ada7..150b80f5fc7 100644
--- a/packages/electron-builder/src/cli/install-app-deps.ts
+++ b/packages/electron-builder/src/cli/install-app-deps.ts
@@ -10,10 +10,10 @@ import { installOrRebuild } from "../yarn"
declare const PACKAGE_VERSION: string
-// https://github.com/yargs/yargs/issues/760
-// demandOption is required to be set
/** @internal */
export function configureInstallAppDepsCommand(yargs: yargs.Yargs): yargs.Yargs {
+ // https://github.com/yargs/yargs/issues/760
+ // demandOption is required to be set
return yargs
.option("platform", {
choices: ["linux", "darwin", "win32"],
diff --git a/packages/electron-builder/src/fileMatcher.ts b/packages/electron-builder/src/fileMatcher.ts
index e066851226d..389ef911e25 100644
--- a/packages/electron-builder/src/fileMatcher.ts
+++ b/packages/electron-builder/src/fileMatcher.ts
@@ -9,6 +9,7 @@ import { Config, FilePattern, PlatformSpecificBuildOptions } from "./metadata"
import { BuildInfo } from "./packagerApi"
import { createFilter, hasMagic } from "./util/filter"
+/** @internal */
export class FileMatcher {
readonly from: string
readonly to: string
@@ -85,6 +86,7 @@ export class FileMatcher {
}
}
+/** @internal */
export function createFileMatcher(info: BuildInfo, appDir: string, resourcesPath: string, macroExpander: (pattern: string) => string, platformSpecificBuildOptions: PlatformSpecificBuildOptions, buildResourceDir: string) {
const patterns = info.isPrepackedAppAsar ? null : getFileMatchers(info.config, "files", appDir, path.join(resourcesPath, "app"), false, macroExpander, platformSpecificBuildOptions)
const matcher = patterns == null ? new FileMatcher(appDir, path.join(resourcesPath, "app"), macroExpander) : patterns[0]
@@ -122,6 +124,7 @@ export function createFileMatcher(info: BuildInfo, appDir: string, resourcesPath
return matcher
}
+/** @internal */
export function getFileMatchers(config: Config, name: "files" | "extraFiles" | "extraResources" | "asarUnpack", defaultSrc: string, defaultDest: string, allowAdvancedMatching: boolean, macroExpander: (pattern: string) => string, customBuildOptions: PlatformSpecificBuildOptions): Array | null {
const globalPatterns: Array | string | n | FilePattern = (config)[name]
const platformSpecificPatterns: Array | string | n = (customBuildOptions)[name]
@@ -168,6 +171,7 @@ export function getFileMatchers(config: Config, name: "files" | "extraFiles" | "
return fileMatchers.length === 0 ? null : fileMatchers
}
+/** @internal */
export function copyFiles(patterns: Array | null): Promise {
if (patterns == null || patterns.length === 0) {
return BluebirdPromise.resolve()
diff --git a/packages/electron-builder/src/fileTransformer.ts b/packages/electron-builder/src/fileTransformer.ts
index e179cb8227e..d6a1cd336c2 100644
--- a/packages/electron-builder/src/fileTransformer.ts
+++ b/packages/electron-builder/src/fileTransformer.ts
@@ -6,6 +6,7 @@ import { readJson } from "fs-extra-p"
import * as path from "path"
import { BuildInfo } from "./packagerApi"
+/** @internal */
export function isElectronCompileUsed(info: BuildInfo): boolean {
if (info.config.electronCompile != null) {
return info.config.electronCompile
@@ -16,6 +17,7 @@ export function isElectronCompileUsed(info: BuildInfo): boolean {
return deps != null && "electron-compile" in deps
}
+/** @internal */
export async function createTransformer(srcDir: string, extraMetadata: any): Promise {
const mainPackageJson = path.join(srcDir, "package.json")
@@ -34,12 +36,14 @@ export async function createTransformer(srcDir: string, extraMetadata: any): Pro
}
}
+/** @internal */
export interface CompilerHost {
compile(file: string): any
saveConfiguration(): Promise
}
+/** @internal */
export function createElectronCompilerHost(projectDir: string, cacheDir: string): Promise {
const electronCompilePath = path.join(projectDir, "node_modules", "electron-compile", "lib")
return require(path.join(electronCompilePath, "config-parser")).createCompilerHostFromProjectRoot(projectDir, cacheDir)
diff --git a/packages/electron-builder/src/packager.ts b/packages/electron-builder/src/packager.ts
index 2b4be393491..9634a0bd1a4 100644
--- a/packages/electron-builder/src/packager.ts
+++ b/packages/electron-builder/src/packager.ts
@@ -255,8 +255,12 @@ export class Packager implements BuildInfo {
const targetList = createTargets(nameToTarget, targetNames.length === 0 ? packager.defaultTarget : targetNames, outDir, packager, cleanupTasks)
const ourDirs = new Set()
for (const target of targetList) {
- const outDir = target.outDir
- if (!createdOutDirs.has(outDir) && !(target instanceof NoOpTarget)) {
+ if (target instanceof NoOpTarget) {
+ continue
+ }
+
+ const outDir = (target).outDir
+ if (createdOutDirs.has(outDir)) {
ourDirs.add(outDir)
}
}
diff --git a/packages/electron-builder/src/packager/dirPackager.ts b/packages/electron-builder/src/packager/dirPackager.ts
index 7fb797b454c..f76a9bde598 100644
--- a/packages/electron-builder/src/packager/dirPackager.ts
+++ b/packages/electron-builder/src/packager/dirPackager.ts
@@ -1,7 +1,7 @@
import { path7za } from "7zip-bin"
import BluebirdPromise from "bluebird-lst"
import { debug7zArgs, spawn } from "electron-builder-util"
-import { copyDir } from "electron-builder-util/out/fs"
+import { copyDir, DO_NOT_USE_HARD_LINKS } from "electron-builder-util/out/fs"
import { log, warn } from "electron-builder-util/out/log"
import { chmod, emptyDir } from "fs-extra-p"
import * as path from "path"
@@ -61,7 +61,7 @@ async function unpack(packager: PlatformPackager, out: string, platform: st
const destination = packager.getElectronDestDir(out)
log(`Copying Electron from "${source}" to "${destination}"`)
await emptyDir(out)
- await copyDir(source, destination)
+ await copyDir(source, destination, null, null, DO_NOT_USE_HARD_LINKS)
}
if (platform === "linux") {
diff --git a/packages/electron-builder/src/readInstalled.ts b/packages/electron-builder/src/readInstalled.ts
index a5ba4c75b43..fd64dc389d1 100644
--- a/packages/electron-builder/src/readInstalled.ts
+++ b/packages/electron-builder/src/readInstalled.ts
@@ -2,6 +2,7 @@ import BluebirdPromise from "bluebird-lst"
import { lstat, readdir, readJson, realpath } from "fs-extra-p"
import * as path from "path"
+/** @internal */
export interface Dependency {
name: string
path: string
@@ -11,6 +12,7 @@ export interface Dependency {
dependencies: { [name: string]: Dependency }
}
+/** @internal */
export async function readInstalled(folder: string): Promise