diff --git a/.idea/dictionaries/develar.xml b/.idea/dictionaries/develar.xml
index 025fdd888e5..84060d6e55d 100644
--- a/.idea/dictionaries/develar.xml
+++ b/.idea/dictionaries/develar.xml
@@ -197,6 +197,7 @@
udif
udro
udrw
+ uitk
ulfo
unassociate
unicon
diff --git a/package.json b/package.json
index 357b389d90c..cfb2672a724 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,7 @@
"ajv": "^5.0.3-beta",
"ajv-keywords": "^2.0.1-beta.1",
"archiver": "^1.3.0",
- "aws-sdk": "^2.22.0",
+ "aws-sdk": "^2.24.0",
"bluebird-lst": "^1.0.1",
"chalk": "^1.1.3",
"chromium-pickle-js": "^0.2.0",
@@ -48,13 +48,14 @@
"minimatch": "^3.0.3",
"node-emoji": "^1.5.1",
"node-forge": "^0.7.0",
- "normalize-package-data": "^2.3.5",
+ "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",
+ "ts-jsdoc": "^1.0.0",
"tunnel-agent": "^0.6.0",
"update-notifier": "^2.1.0",
"uuid-1345": "^0.99.6",
@@ -65,7 +66,7 @@
"@types/ini": "^1.3.29",
"@types/jest": "^18.1.1",
"@types/js-yaml": "^3.5.29",
- "@types/node-forge": "^0.6.5",
+ "@types/node-forge": "^0.6.6",
"@types/source-map-support": "^0.2.28",
"@types/xml2js": "^0.0.32",
"babel-plugin-array-includes": "^2.0.3",
@@ -81,11 +82,11 @@
"electron-download-tf": "4.0.0",
"jest-cli": "^19.0.2",
"jest-environment-node-debug": "^2.0.0",
- "jest-junit": "^1.2.0",
+ "jest-junit": "^1.3.0",
"jsdoc": "^3.4.3",
"path-sort": "^0.1.0",
"source-map-support": "^0.4.11",
- "ts-babel": "^1.4.4",
+ "ts-babel": "^2.0.0",
"tslint": "^4.5.1",
"typescript": "^2.2.1",
"typescript-json-schema": "0.10.0",
diff --git a/packages/electron-builder-core/src/core.ts b/packages/electron-builder-core/src/core.ts
index c2050753e1a..8f304696fe8 100644
--- a/packages/electron-builder-core/src/core.ts
+++ b/packages/electron-builder-core/src/core.ts
@@ -2,10 +2,26 @@ export enum Arch {
ia32, x64, armv7l
}
+export type ArchType = "x64" | "ia32" | "armv7l"
+
export function getArchSuffix(arch: Arch): string {
return arch === Arch.x64 ? "" : `-${Arch[arch]}`
}
+export type TargetConfigType = Array | string | TargetConfig | null
+
+export interface TargetConfig {
+ /**
+ * The target name. e.g. `snap`.
+ */
+ readonly target: string
+
+ /**
+ * The arch or list of archs.
+ */
+ readonly arch?: Array<"x64" | "ia32" | "armv7l"> | string
+}
+
export function toLinuxArchString(arch: Arch) {
return arch === Arch.ia32 ? "i386" : (arch === Arch.x64 ? "amd64" : "armv7l")
}
@@ -41,6 +57,10 @@ export class Platform {
}
createTarget(type?: string | Array | null, ...archs: Array): Map>> {
+ if (type == null && (archs == null || archs.length === 0)) {
+ return new Map([[this, new Map()]])
+ }
+
const archToType = new Map()
if (this === Platform.MAC) {
archs = [Arch.x64]
@@ -97,4 +117,7 @@ export interface TargetSpecificOptions {
readonly artifactName?: string | null
readonly forceCodeSigning?: boolean
-}
\ No newline at end of file
+}
+
+export const DEFAULT_TARGET = "default"
+export const DIR_TARGET = "dir"
\ No newline at end of file
diff --git a/packages/electron-builder-squirrel-windows/src/squirrelWindows.ts b/packages/electron-builder-squirrel-windows/src/squirrelWindows.ts
index 7eb9eea7dc5..5dbb8ec8bdd 100644
--- a/packages/electron-builder-squirrel-windows/src/squirrelWindows.ts
+++ b/packages/electron-builder-squirrel-windows/src/squirrelWindows.ts
@@ -1,10 +1,10 @@
+import { Arch, getArchSuffix, Target } from "electron-builder-core"
+import { getBinFromBintray } from "electron-builder-util/out/binDownload"
+import { log, warn } from "electron-builder-util/out/log"
+import { SquirrelWindowsOptions } from "electron-builder/out/options/winOptions"
import { WinPackager } from "electron-builder/out/winPackager"
import * as path from "path"
-import { warn, log } from "electron-builder-util/out/log"
-import { getBinFromBintray } from "electron-builder-util/out/binDownload"
import { buildInstaller, convertVersion, SquirrelOptions } from "./squirrelPack"
-import { SquirrelWindowsOptions } from "electron-builder/out/options/winOptions"
-import { Target, Arch, getArchSuffix } from "electron-builder-core"
const SW_VERSION = "1.5.2.0"
//noinspection SpellCheckingInspection
@@ -75,7 +75,7 @@ export default class SquirrelWindowsTarget extends Target {
iconUrl: iconUrl,
extraMetadataSpecs: projectUrl == null ? null : `\n ${projectUrl}`,
copyright: appInfo.copyright,
- packageCompressionLevel: packager.config.compression === "store" ? 0 : 9,
+ packageCompressionLevel: parseInt(process.env.ELECTRON_BUILDER_COMPRESSION_LEVEL) || (packager.config.compression === "store" ? 0 : 9),
vendorPath: await getBinFromBintray("Squirrel.Windows", SW_VERSION, SW_SHA2)
}, this.options)
diff --git a/packages/electron-builder-util/src/util.ts b/packages/electron-builder-util/src/util.ts
index 69af53e437d..054589d81c4 100644
--- a/packages/electron-builder-util/src/util.ts
+++ b/packages/electron-builder-util/src/util.ts
@@ -1,4 +1,3 @@
-import "source-map-support/register"
import BluebirdPromise from "bluebird-lst"
import { red, yellow } from "chalk"
import { ChildProcess, execFile, spawn as _spawn, SpawnOptions } from "child_process"
@@ -6,6 +5,7 @@ import { createHash } from "crypto"
import _debug from "debug"
import { homedir, tmpdir } from "os"
import * as path from "path"
+import "source-map-support/register"
import { statOrNull } from "./fs"
import { log, warn } from "./log"
@@ -252,4 +252,31 @@ export class Lazy {
constructor(creator: () => Promise) {
this.creator = creator
}
+}
+
+export function addValue(map: Map>, key: K, value: T) {
+ const list = map.get(key)
+ if (list == null) {
+ map.set(key, [value])
+ }
+ else if (!list.includes(value)) {
+ list.push(value)
+ }
+}
+
+export function replaceDefault(inList: Array | null | undefined, defaultList: Array): Array {
+ if (inList == null) {
+ return defaultList
+ }
+
+ const index = inList.indexOf("default")
+ if (index >= 0) {
+ let list = inList.slice(0, index)
+ list.push(...defaultList)
+ if (index != (inList.length - 1)) {
+ list.push(...inList.slice(index + 1))
+ }
+ inList = list
+ }
+ return inList
}
\ No newline at end of file
diff --git a/packages/electron-builder/package.json b/packages/electron-builder/package.json
index 9ebc1287b61..3530748719e 100644
--- a/packages/electron-builder/package.json
+++ b/packages/electron-builder/package.json
@@ -63,7 +63,7 @@
"isbinaryfile": "^3.0.2",
"js-yaml": "^3.8.2",
"minimatch": "^3.0.3",
- "normalize-package-data": "^2.3.5",
+ "normalize-package-data": "^2.3.6",
"parse-color": "^1.0.0",
"plist": "^2.0.1",
"sanitize-filename": "^1.6.1",
diff --git a/packages/electron-builder/src/builder.ts b/packages/electron-builder/src/builder.ts
index 24be562534c..7cdd4a43120 100644
--- a/packages/electron-builder/src/builder.ts
+++ b/packages/electron-builder/src/builder.ts
@@ -1,14 +1,13 @@
import BluebirdPromise from "bluebird-lst"
-import { Arch, archFromString, Platform } from "electron-builder-core"
+import { Arch, archFromString, DIR_TARGET, Platform } from "electron-builder-core"
import { CancellationToken } from "electron-builder-http/out/CancellationToken"
-import { isEmptyOrSpaces } from "electron-builder-util"
+import { addValue, isEmptyOrSpaces } from "electron-builder-util"
import { warn } from "electron-builder-util/out/log"
import { executeFinally } from "electron-builder-util/out/promise"
import { PublishOptions } from "electron-publish"
import { normalizePlatforms, Packager } from "./packager"
import { PackagerOptions } from "./packagerApi"
import { PublishManager } from "./publish/PublishManager"
-import { DIR_TARGET } from "./targets/targetFactory"
export interface BuildOptions extends PackagerOptions, PublishOptions {
}
@@ -31,16 +30,6 @@ export interface CliOptions extends PackagerOptions, PublishOptions {
project?: string
}
-function addValue(map: Map>, key: K, value: T) {
- const list = map.get(key)
- if (list == null) {
- map.set(key, [value])
- }
- else {
- list.push(value)
- }
-}
-
export function normalizeOptions(args: CliOptions): BuildOptions {
if (args.targets != null) {
return args
@@ -49,14 +38,11 @@ export function normalizeOptions(args: CliOptions): BuildOptions {
let targets = new Map>>()
function processTargets(platform: Platform, types: Array) {
- if (args.platform != null) {
- throw new Error(`--platform cannot be used if --${platform.buildConfigurationKey} is passed`)
- }
- if (args.arch != null) {
- throw new Error(`--arch cannot be used if --${platform.buildConfigurationKey} is passed`)
- }
+ function commonArch(currentIfNotSpecified: boolean): Array {
+ if (platform === Platform.MAC) {
+ return [Arch.x64]
+ }
- function commonArch(): Array {
const result = Array()
if (args.x64) {
result.push(Arch.x64)
@@ -68,7 +54,14 @@ export function normalizeOptions(args: CliOptions): BuildOptions {
result.push(Arch.ia32)
}
- return result.length === 0 ? [archFromString(process.arch)] : result
+ return result.length === 0 && currentIfNotSpecified ? [archFromString(process.arch)] : result
+ }
+
+ if (args.platform != null) {
+ throw new Error(`--platform cannot be used if --${platform.buildConfigurationKey} is passed`)
+ }
+ if (args.arch != null) {
+ throw new Error(`--arch cannot be used if --${platform.buildConfigurationKey} is passed`)
}
let archToType = targets.get(platform)
@@ -79,32 +72,20 @@ export function normalizeOptions(args: CliOptions): BuildOptions {
if (types.length === 0) {
const defaultTargetValue = args.dir ? [DIR_TARGET] : []
- if (platform === Platform.MAC) {
- archToType.set(Arch.x64, defaultTargetValue)
- }
- else {
- for (const arch of commonArch()) {
- archToType.set(arch, defaultTargetValue)
- }
+ for (const arch of commonArch(false)) {
+ archToType.set(arch, defaultTargetValue)
}
return
}
for (const type of types) {
- let arch: string
- if (platform === Platform.MAC) {
- arch = "x64"
- addValue(archToType, Arch.x64, type)
+ const suffixPos = type.lastIndexOf(":")
+ if (suffixPos > 0) {
+ addValue(archToType, archFromString(type.substring(suffixPos + 1)), type.substring(0, suffixPos))
}
else {
- const suffixPos = type.lastIndexOf(":")
- if (suffixPos > 0) {
- addValue(archToType, archFromString(type.substring(suffixPos + 1)), type.substring(0, suffixPos))
- }
- else {
- for (const arch of commonArch()) {
- addValue(archToType, arch, type)
- }
+ for (const arch of commonArch(true)) {
+ addValue(archToType, arch, type)
}
}
}
diff --git a/packages/electron-builder/src/index.ts b/packages/electron-builder/src/index.ts
index d51cea3e9ec..3ac5f5145bd 100644
--- a/packages/electron-builder/src/index.ts
+++ b/packages/electron-builder/src/index.ts
@@ -1,9 +1,8 @@
export { Packager } from "./packager"
export { PackagerOptions, ArtifactCreated, BuildInfo, SourceRepositoryInfo } from "./packagerApi"
-export { getArchSuffix, Platform, Arch, archFromString, Target } from "electron-builder-core"
+export { getArchSuffix, Platform, Arch, archFromString, Target, DIR_TARGET } from "electron-builder-core"
export { BuildOptions, build, CliOptions, createTargets } from "./builder"
export { Metadata, Config, CompressionLevel, FilePattern } from "./metadata"
export { MacOptions, DmgOptions, MasBuildOptions, MacOsTargetName, PkgOptions } from "./options/macOptions"
export { WinBuildOptions, NsisOptions, SquirrelWindowsOptions, AppXOptions } from "./options/winOptions"
-export { LinuxBuildOptions, DebOptions } from "./options/linuxOptions"
-export { DIR_TARGET } from "./targets/targetFactory"
\ No newline at end of file
+export { LinuxBuildOptions, DebOptions } from "./options/linuxOptions"
\ No newline at end of file
diff --git a/packages/electron-builder/src/linuxPackager.ts b/packages/electron-builder/src/linuxPackager.ts
index 224f3b0cd94..c5bbc7f7989 100755
--- a/packages/electron-builder/src/linuxPackager.ts
+++ b/packages/electron-builder/src/linuxPackager.ts
@@ -1,4 +1,4 @@
-import { Platform, Target } from "electron-builder-core"
+import { DIR_TARGET, Platform, Target } from "electron-builder-core"
import { rename } from "fs-extra-p"
import * as path from "path"
import sanitizeFileName from "sanitize-filename"
@@ -9,7 +9,7 @@ import AppImageTarget from "./targets/appImage"
import FpmTarget from "./targets/fpm"
import { LinuxTargetHelper } from "./targets/LinuxTargetHelper"
import SnapTarget from "./targets/snap"
-import { createCommonTarget, DIR_TARGET } from "./targets/targetFactory"
+import { createCommonTarget } from "./targets/targetFactory"
export class LinuxPackager extends PlatformPackager {
readonly executableName: string
diff --git a/packages/electron-builder/src/macPackager.ts b/packages/electron-builder/src/macPackager.ts
index be4694594d8..04c754db6e9 100644
--- a/packages/electron-builder/src/macPackager.ts
+++ b/packages/electron-builder/src/macPackager.ts
@@ -1,5 +1,5 @@
import BluebirdPromise from "bluebird-lst"
-import { Arch, Platform, Target } from "electron-builder-core"
+import { Arch, DIR_TARGET, Platform, Target } from "electron-builder-core"
import { exec } from "electron-builder-util"
import { deepAssign } from "electron-builder-util/out/deepAssign"
import { log, task, warn } from "electron-builder-util/out/log"
@@ -13,7 +13,7 @@ import { BuildInfo } from "./packagerApi"
import { PlatformPackager } from "./platformPackager"
import { DmgTarget } from "./targets/dmg"
import { PkgTarget, prepareProductBuildArgs } from "./targets/pkg"
-import { createCommonTarget, DIR_TARGET, NoOpTarget } from "./targets/targetFactory"
+import { createCommonTarget, NoOpTarget } from "./targets/targetFactory"
export default class MacPackager extends PlatformPackager {
readonly codeSigningInfo: Promise
diff --git a/packages/electron-builder/src/metadata.ts b/packages/electron-builder/src/metadata.ts
index 9eb75008c2b..439ee883972 100755
--- a/packages/electron-builder/src/metadata.ts
+++ b/packages/electron-builder/src/metadata.ts
@@ -1,6 +1,6 @@
-import { Arch, Platform, Target, TargetSpecificOptions } from "electron-builder-core"
+import { Arch, Platform, Target, TargetConfig, TargetSpecificOptions } from "electron-builder-core"
import { Publish } from "electron-builder-http/out/publishOptions"
-import { DebOptions, LinuxBuildOptions, SnapOptions } from "./options/linuxOptions"
+import { AppImageOptions, DebOptions, LinuxBuildOptions, SnapOptions } from "./options/linuxOptions"
import { DmgOptions, MacOptions, MasBuildOptions, PkgOptions } from "./options/macOptions"
import { AppXOptions, NsisOptions, SquirrelWindowsOptions, WinBuildOptions } from "./options/winOptions"
import { PlatformPackager } from "./platformPackager"
@@ -143,13 +143,20 @@ export interface Config extends PlatformSpecificBuildOptions, TargetSpecificOpti
readonly win?: WinBuildOptions | null
readonly nsis?: NsisOptions | null
+ readonly portable?: NsisOptions | null
readonly pkg?: PkgOptions | null
- readonly squirrelWindows?: SquirrelWindowsOptions | null
readonly appx?: AppXOptions | null
+ readonly squirrelWindows?: SquirrelWindowsOptions | null
readonly linux?: LinuxBuildOptions | null
readonly deb?: DebOptions | null
readonly snap?: SnapOptions | null
+ readonly appimage?: AppImageOptions | null
+ readonly pacman?: LinuxBuildOptions | null
+ readonly rpm?: LinuxBuildOptions | null
+ readonly freebsd?: LinuxBuildOptions | null
+ readonly p5p?: LinuxBuildOptions | null
+ readonly apk?: LinuxBuildOptions | null
/**
The compression level, one of `store`, `normal`, `maximum` (default: `normal`). If you want to rapidly test build, `store` can reduce build time significantly.
@@ -336,7 +343,7 @@ export interface PlatformSpecificBuildOptions extends TargetSpecificOptions {
readonly asar?: AsarOptions | boolean | null
- readonly target?: Array | string | null
+ readonly target?: Array | string | TargetConfig | null
readonly icon?: string | null
diff --git a/packages/electron-builder/src/options/linuxOptions.ts b/packages/electron-builder/src/options/linuxOptions.ts
index f94fad73774..07e20f5093a 100644
--- a/packages/electron-builder/src/options/linuxOptions.ts
+++ b/packages/electron-builder/src/options/linuxOptions.ts
@@ -1,3 +1,4 @@
+import { TargetConfigType } from "electron-builder-core"
import { PlatformSpecificBuildOptions } from "../metadata"
/**
@@ -26,7 +27,7 @@ export interface LinuxBuildOptions extends PlatformSpecificBuildOptions {
electron-builder [docker image](https://github.com/electron-userland/electron-builder/wiki/Docker) can be used to build Linux targets on any platform. See [Multi platform build](https://github.com/electron-userland/electron-builder/wiki/Multi-Platform-Build).
*/
- readonly target?: Array | null
+ readonly target?: TargetConfigType
/**
The maintainer. Defaults to [author](#AppMetadata-author).
diff --git a/packages/electron-builder/src/options/macOptions.ts b/packages/electron-builder/src/options/macOptions.ts
index 2825e545172..13f8f990d66 100644
--- a/packages/electron-builder/src/options/macOptions.ts
+++ b/packages/electron-builder/src/options/macOptions.ts
@@ -1,4 +1,4 @@
-import { TargetSpecificOptions } from "electron-builder-core"
+import { TargetConfig, TargetSpecificOptions } from "electron-builder-core"
import { PlatformSpecificBuildOptions } from "../metadata"
export type MacOsTargetName = "default" | "dmg" | "mas" | "pkg" | "7z" | "zip" | "tar.xz" | "tar.lz" | "tar.gz" | "tar.bz2" | "dir"
@@ -19,7 +19,7 @@ export interface MacOptions extends PlatformSpecificBuildOptions {
/**
The target package type: list of `default`, `dmg`, `mas`, `pkg`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`. Defaults to `default` (dmg and zip for Squirrel.Mac).
*/
- readonly target?: Array | null
+ readonly target?: Array | MacOsTargetName | TargetConfig | null
/**
The name of certificate to use when signing. Consider using environment variables [CSC_LINK or CSC_NAME](https://github.com/electron-userland/electron-builder/wiki/Code-Signing) instead of specifying this option.
diff --git a/packages/electron-builder/src/options/winOptions.ts b/packages/electron-builder/src/options/winOptions.ts
index 6af2c7d6d4d..1ca3d672e65 100644
--- a/packages/electron-builder/src/options/winOptions.ts
+++ b/packages/electron-builder/src/options/winOptions.ts
@@ -1,3 +1,4 @@
+import { TargetConfigType } from "electron-builder-core"
import { PlatformSpecificBuildOptions } from "../metadata"
/**
@@ -11,7 +12,7 @@ export interface WinBuildOptions extends PlatformSpecificBuildOptions {
To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency.
*/
- readonly target?: Array | null
+ readonly target?: TargetConfigType
/**
Array of signing algorithms used. Defaults to `['sha1', 'sha256']`
diff --git a/packages/electron-builder/src/packager.ts b/packages/electron-builder/src/packager.ts
index b40ca1245ab..a935745542d 100644
--- a/packages/electron-builder/src/packager.ts
+++ b/packages/electron-builder/src/packager.ts
@@ -17,7 +17,7 @@ import { AfterPackContext, Config, Metadata } from "./metadata"
import { ArtifactCreated, BuildInfo, PackagerOptions, SourceRepositoryInfo } from "./packagerApi"
import { PlatformPackager } from "./platformPackager"
import { getRepositoryInfo } from "./repositoryInfo"
-import { createTargets, NoOpTarget } from "./targets/targetFactory"
+import { computeArchToTargetNamesMap, createTargets, NoOpTarget } from "./targets/targetFactory"
import { doLoadConfig, getElectronVersion, loadConfig, readPackageJson, validateConfig } from "./util/readPackageJson"
import { WinPackager } from "./winPackager"
import { getGypEnv, installOrRebuild } from "./yarn"
@@ -86,7 +86,7 @@ export class Packager implements BuildInfo {
this.eventEmitter.emit("artifactCreated", event)
}
- async build(): Promise