diff --git a/.babelrc b/.babelrc
new file mode 100644
index 00000000000..5c5ae7d7630
--- /dev/null
+++ b/.babelrc
@@ -0,0 +1,43 @@
+{
+ env: {
+ development: {
+ plugins: [
+ [
+ "transform-async-to-module-method",
+ {
+ module: "bluebird-lst-c",
+ method: "coroutine"
+ }
+ ],
+ "transform-es2015-parameters",
+ "transform-es2015-spread",
+ "transform-es2015-destructuring",
+ "array-includes",
+ [
+ "transform-inline-imports-commonjs",
+ {
+ excludeModules: ["path"]
+ }
+ ],
+ ],
+ },
+ test: {
+ sourceMaps: "inline",
+ plugins: [
+ [
+ "transform-async-to-module-method",
+ {
+ module: "bluebird-lst-c",
+ method: "coroutine"
+ }
+ ],
+ [
+ "transform-inline-imports-commonjs",
+ {
+ excludeModules: ["path"]
+ }
+ ],
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml
index f9db70b81e0..1038133a841 100644
--- a/.idea/codeStyleSettings.xml
+++ b/.idea/codeStyleSettings.xml
@@ -20,6 +20,9 @@
+
+
+
diff --git a/.idea/dictionaries/develar.xml b/.idea/dictionaries/develar.xml
index dd56977cc42..f0a00dae295 100644
--- a/.idea/dictionaries/develar.xml
+++ b/.idea/dictionaries/develar.xml
@@ -16,6 +16,8 @@
appxmanifest
archiver
archs
+ armv
+ asar
aspx
atexit
atime
@@ -40,6 +42,7 @@
debian
depcheck
devel
+ develar
devmode
difflet
digester
@@ -72,6 +75,7 @@
hklm
homedir
hrtime
+ icns
icnsutils
icnv
iconset
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index 3d4082833f6..1feb5064e3b 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -6,6 +6,9 @@
+
+
+
diff --git a/.idea/scopes/json5.xml b/.idea/scopes/json5.xml
new file mode 100644
index 00000000000..e11bd99491d
--- /dev/null
+++ b/.idea/scopes/json5.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/docs/Options.md b/docs/Options.md
index 752caa430c1..6c0a2dee412 100644
--- a/docs/Options.md
+++ b/docs/Options.md
@@ -58,7 +58,6 @@ Don't customize paths to background and icon, — just follow conventions.
| Name | Description
| --- | ---
| **build** | See [.build](#BuildMetadata).
-| directories | See [.directories](#MetadataDirectories)
## `.build`
@@ -91,6 +90,8 @@ Don't customize paths to background and icon, — just follow conventions.
| electronDist | The path to custom Electron build (e.g. `~/electron/out/R`). Only macOS supported, file issue if need for Linux or Windows.
| electronDownload | The [electron-download](https://github.com/electron-userland/electron-download#usage) options.
| publish | See [.build.publish](#PublishConfiguration).
+| forceCodeSigning | Whether to fail if application will be not signed (to prevent unsigned app if code signing configuration is not correct).
+| directories | See [.directories](#MetadataDirectories)
### `.build.dmg`
diff --git a/docs/programmaticUsage.js b/docs/programmaticUsage.js
index d658d95d3ad..093d67a56f7 100644
--- a/docs/programmaticUsage.js
+++ b/docs/programmaticUsage.js
@@ -6,7 +6,7 @@ const builder = require("electron-builder")
builder.build({
platform: [builder.Platform.MAC],
"//": "platform, arch and other properties, see PackagerOptions in the node_modules/electron-builder/out/electron-builder.d.ts",
- devMetadata: {
+ config: {
"//": "build and other properties, see https://goo.gl/5jVxoO"
}
})
diff --git a/package.json b/package.json
index 80cfe46c9a5..2fd95f158cb 100644
--- a/package.json
+++ b/package.json
@@ -120,51 +120,6 @@
"typescript": "^2.1.4",
"whitespace": "^2.1.0"
},
- "babel": {
- "plugins": [
- [
- "transform-async-to-module-method",
- {
- "module": "bluebird-lst-c",
- "method": "coroutine"
- }
- ],
- "transform-es2015-parameters",
- "transform-es2015-spread",
- "transform-es2015-destructuring",
- "array-includes",
- [
- "transform-inline-imports-commonjs",
- {
- "excludeModules": [
- "path"
- ]
- }
- ]
- ],
- "env": {
- "test": {
- "sourceMaps": "inline",
- "plugins": [
- [
- "transform-async-to-module-method",
- {
- "module": "bluebird-lst-c",
- "method": "coroutine"
- }
- ],
- [
- "transform-inline-imports-commonjs",
- {
- "excludeModules": [
- "path"
- ]
- }
- ]
- ]
- }
- }
- },
"jest": {
"testEnvironment": "node",
"testPathDirs": [
diff --git a/src/appInfo.ts b/src/appInfo.ts
index 8b9a686718f..7db028c4d55 100644
--- a/src/appInfo.ts
+++ b/src/appInfo.ts
@@ -1,4 +1,4 @@
-import { DevMetadata, AppMetadata } from "./metadata"
+import { DevMetadata, AppMetadata, BuildMetadata } from "./metadata"
import { warn } from "./util/log"
import { smarten } from "./platformPackager"
import { isEmptyOrSpaces } from "./util/util"
@@ -15,10 +15,14 @@ export class AppInfo {
readonly productName: string
readonly productFilename: string
+ private get config(): BuildMetadata {
+ return this.devMetadata.build
+ }
+
constructor(public metadata: AppMetadata, private devMetadata: DevMetadata, buildVersion?: string | null) {
this.version = metadata.version!
- this.buildNumber = (this.devMetadata.build)["build-version"] || process.env.TRAVIS_BUILD_NUMBER || process.env.APPVEYOR_BUILD_NUMBER || process.env.CIRCLE_BUILD_NUM || process.env.BUILD_NUMBER
+ this.buildNumber = (this.config)["build-version"] || process.env.TRAVIS_BUILD_NUMBER || process.env.APPVEYOR_BUILD_NUMBER || process.env.CIRCLE_BUILD_NUM || process.env.BUILD_NUMBER
if (isEmptyOrSpaces(buildVersion)) {
buildVersion = this.version
@@ -31,7 +35,7 @@ export class AppInfo {
this.buildVersion = buildVersion!
}
- this.productName = getProductName(this.metadata, this.devMetadata)
+ this.productName = this.config.productName || metadata.productName || metadata.name
this.productFilename = sanitizeFileName(this.productName)
}
@@ -45,13 +49,13 @@ export class AppInfo {
}
get id(): string {
- let appId = this.devMetadata.build["app-bundle-id"]
+ let appId = this.config["app-bundle-id"]
if (appId != null) {
warn("app-bundle-id is deprecated, please use appId")
}
- if (this.devMetadata.build.appId != null) {
- appId = this.devMetadata.build.appId
+ if (this.config.appId != null) {
+ appId = this.config.appId
}
const generateDefaultAppId = () => {
@@ -72,7 +76,7 @@ export class AppInfo {
}
get copyright(): string {
- const copyright = this.devMetadata.build.copyright
+ const copyright = this.config.copyright
if (copyright != null) {
return copyright
}
@@ -80,19 +84,12 @@ export class AppInfo {
}
async computePackageUrl(): Promise {
- const url = this.metadata.homepage || this.devMetadata.homepage
+ const url = this.metadata.homepage
if (url != null) {
return url
}
const info = await getRepositoryInfo(this.metadata, this.devMetadata)
- if (info != null) {
- return `https://github.com/${info.user}/${info.project}`
- }
- return null
+ return info == null ? null : `https://github.com/${info.user}/${info.project}`
}
-}
-
-function getProductName(metadata: AppMetadata, devMetadata: DevMetadata) {
- return devMetadata.build.productName || metadata.productName || metadata.name
}
\ No newline at end of file
diff --git a/src/cli/install-app-deps.ts b/src/cli/install-app-deps.ts
index 26679a6a9a9..e374fe7de29 100644
--- a/src/cli/install-app-deps.ts
+++ b/src/cli/install-app-deps.ts
@@ -1,5 +1,5 @@
#! /usr/bin/env node
-import { computeDefaultAppDirectory, getElectronVersion, use } from "../util/util"
+import { computeDefaultAppDirectory, getElectronVersion, use, getDirectoriesConfig } from "../util/util"
import { printErrorAndExit } from "../util/promise"
import * as path from "path"
import BluebirdPromise from "bluebird-lst-c"
@@ -19,7 +19,7 @@ async function main() {
const devMetadata: DevMetadata = await readPackageJson(devPackageFile)
const results: Array = await BluebirdPromise.all([
- computeDefaultAppDirectory(projectDir, use(devMetadata.directories, it => it!.app)),
+ computeDefaultAppDirectory(projectDir, use(getDirectoriesConfig(devMetadata), it => it!.app)),
getElectronVersion(devMetadata, devPackageFile)
])
diff --git a/src/macPackager.ts b/src/macPackager.ts
index b68219bd612..a98cab583b6 100644
--- a/src/macPackager.ts
+++ b/src/macPackager.ts
@@ -32,11 +32,11 @@ export default class MacPackager extends PlatformPackager {
}
protected prepareAppInfo(appInfo: AppInfo): AppInfo {
- return new AppInfo(appInfo.metadata, this.devMetadata, this.platformSpecificBuildOptions.bundleVersion)
+ return new AppInfo(appInfo.metadata, this.info.devMetadata, this.platformSpecificBuildOptions.bundleVersion)
}
async getIconPath(): Promise {
- let iconPath = this.platformSpecificBuildOptions.icon || this.devMetadata.build.icon
+ let iconPath = this.platformSpecificBuildOptions.icon || this.config.icon
if (iconPath != null && !iconPath.endsWith(".icns")) {
iconPath += ".icns"
}
@@ -82,7 +82,7 @@ export default class MacPackager extends PlatformPackager {
if (hasMas) {
const appOutDir = path.join(outDir, "mas")
- const masBuildOptions = deepAssign({}, this.platformSpecificBuildOptions, (this.devMetadata.build).mas)
+ const masBuildOptions = deepAssign({}, this.platformSpecificBuildOptions, (this.config).mas)
await this.doPack(outDir, appOutDir, "mas", arch, masBuildOptions)
await this.sign(appOutDir, masBuildOptions)
}
@@ -113,7 +113,7 @@ export default class MacPackager extends PlatformPackager {
if (name == null) {
let message = `App is not signed: cannot find valid ${isMas ? '"3rd Party Mac Developer Application" identity' : `"Developer ID Application" identity or custom non-Apple code signing certificate`}, see https://github.com/electron-userland/electron-builder/wiki/Code-Signing`
- if (isMas) {
+ if (isMas || this.platformSpecificBuildOptions.forceCodeSigning) {
throw new Error(message)
}
else {
@@ -172,7 +172,7 @@ export default class MacPackager extends PlatformPackager {
}
async findInstallerIdentity(isMas: boolean, keychainName: string | n): Promise {
- const targetSpecificOptions: MacOptions = (this.devMetadata.build)[isMas ? "mas" : "pkg"] || this.platformSpecificBuildOptions
+ const targetSpecificOptions: MacOptions = (this.config)[isMas ? "mas" : "pkg"] || this.platformSpecificBuildOptions
const name = isMas ? "3rd Party Mac Developer Installer" : "Developer ID Installer"
let installerName = await findIdentity(name, targetSpecificOptions.identity, keychainName)
if (installerName != null) {
diff --git a/src/metadata.ts b/src/metadata.ts
index 713c2c4e840..ce8b78cc59b 100755
--- a/src/metadata.ts
+++ b/src/metadata.ts
@@ -58,17 +58,6 @@ export interface DevMetadata extends Metadata {
See [.build](#BuildMetadata).
*/
readonly build: BuildMetadata
-
- // deprecated
- readonly homepage?: string | null
-
- // deprecated
- readonly license?: string | null
-
- /*
- See [.directories](#MetadataDirectories)
- */
- readonly directories?: MetadataDirectories | null
}
export interface RepositoryInfo {
@@ -241,6 +230,16 @@ export interface BuildMetadata {
See [.build.publish](#PublishConfiguration).
*/
readonly publish?: Publish
+
+ /*
+ Whether to fail if application will be not signed (to prevent unsigned app if code signing configuration is not correct).
+ */
+ readonly forceCodeSigning?: boolean
+
+ /*
+ See [.directories](#MetadataDirectories)
+ */
+ readonly directories?: MetadataDirectories | null
}
export interface AfterPackContext {
@@ -344,6 +343,8 @@ export interface PlatformSpecificBuildOptions {
readonly fileAssociations?: Array | FileAssociation
readonly publish?: Publish
+
+ readonly forceCodeSigning?: boolean
}
export class Platform {
diff --git a/src/packager.ts b/src/packager.ts
index c9890ba93cb..2c3b11a871c 100644
--- a/src/packager.ts
+++ b/src/packager.ts
@@ -1,9 +1,9 @@
import * as path from "path"
-import { computeDefaultAppDirectory, getElectronVersion, use, exec, isEmptyOrSpaces } from "./util/util"
+import { computeDefaultAppDirectory, getElectronVersion, use, exec, isEmptyOrSpaces, getDirectoriesConfig } from "./util/util"
import { all, executeFinally } from "./util/promise"
import { EventEmitter } from "events"
import BluebirdPromise from "bluebird-lst-c"
-import { AppMetadata, DevMetadata, Platform, Arch } from "./metadata"
+import { AppMetadata, DevMetadata, Platform, Arch, BuildMetadata } from "./metadata"
import { PlatformPackager, BuildInfo, ArtifactCreated } from "./platformPackager"
import { WinPackager } from "./winPackager"
import * as errorMessages from "./errorMessages"
@@ -28,8 +28,13 @@ export class Packager implements BuildInfo {
appDir: string
metadata: AppMetadata
+
devMetadata: DevMetadata
+ get config(): BuildMetadata {
+ return this.devMetadata.build
+ }
+
isTwoPackageJsonProjectLayoutUsed = true
electronVersion: string
@@ -55,12 +60,21 @@ export class Packager implements BuildInfo {
}
async build(): Promise