Skip to content

Commit 4faa3fb

Browse files
committed
feat: force application signing
Babel config moved to .babelrc because: * jest invalidate cache on config file modification * json5 can be used instead of ugly raw json config option added as preparation to additional config file in yaml. Closes #975
1 parent 88ce3b7 commit 4faa3fb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+330
-344
lines changed

.babelrc

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
env: {
3+
development: {
4+
plugins: [
5+
[
6+
"transform-async-to-module-method",
7+
{
8+
module: "bluebird-lst-c",
9+
method: "coroutine"
10+
}
11+
],
12+
"transform-es2015-parameters",
13+
"transform-es2015-spread",
14+
"transform-es2015-destructuring",
15+
"array-includes",
16+
[
17+
"transform-inline-imports-commonjs",
18+
{
19+
excludeModules: ["path"]
20+
}
21+
],
22+
],
23+
},
24+
test: {
25+
sourceMaps: "inline",
26+
plugins: [
27+
[
28+
"transform-async-to-module-method",
29+
{
30+
module: "bluebird-lst-c",
31+
method: "coroutine"
32+
}
33+
],
34+
[
35+
"transform-inline-imports-commonjs",
36+
{
37+
excludeModules: ["path"]
38+
}
39+
],
40+
]
41+
}
42+
}
43+
}

.idea/codeStyleSettings.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/dictionaries/develar.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/scopes/json5.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/Options.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ Don't customize paths to background and icon, — just follow conventions.
5858
| Name | Description
5959
| --- | ---
6060
| **build** | <a name="DevMetadata-build"></a>See [.build](#BuildMetadata).
61-
| directories | <a name="DevMetadata-directories"></a>See [.directories](#MetadataDirectories)
6261

6362
<a name="BuildMetadata"></a>
6463
## `.build`
@@ -91,6 +90,8 @@ Don't customize paths to background and icon, — just follow conventions.
9190
| electronDist | <a name="BuildMetadata-electronDist"></a>The path to custom Electron build (e.g. `~/electron/out/R`). Only macOS supported, file issue if need for Linux or Windows.
9291
| electronDownload | <a name="BuildMetadata-electronDownload"></a>The [electron-download](https://github.com/electron-userland/electron-download#usage) options.
9392
| publish | <a name="BuildMetadata-publish"></a>See [.build.publish](#PublishConfiguration).
93+
| forceCodeSigning | <a name="BuildMetadata-forceCodeSigning"></a>Whether to fail if application will be not signed (to prevent unsigned app if code signing configuration is not correct).
94+
| directories | <a name="BuildMetadata-directories"></a>See [.directories](#MetadataDirectories)
9495

9596
<a name="DmgOptions"></a>
9697
### `.build.dmg`

docs/programmaticUsage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const builder = require("electron-builder")
66
builder.build({
77
platform: [builder.Platform.MAC],
88
"//": "platform, arch and other properties, see PackagerOptions in the node_modules/electron-builder/out/electron-builder.d.ts",
9-
devMetadata: {
9+
config: {
1010
"//": "build and other properties, see https://goo.gl/5jVxoO"
1111
}
1212
})

package.json

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -120,51 +120,6 @@
120120
"typescript": "^2.1.4",
121121
"whitespace": "^2.1.0"
122122
},
123-
"babel": {
124-
"plugins": [
125-
[
126-
"transform-async-to-module-method",
127-
{
128-
"module": "bluebird-lst-c",
129-
"method": "coroutine"
130-
}
131-
],
132-
"transform-es2015-parameters",
133-
"transform-es2015-spread",
134-
"transform-es2015-destructuring",
135-
"array-includes",
136-
[
137-
"transform-inline-imports-commonjs",
138-
{
139-
"excludeModules": [
140-
"path"
141-
]
142-
}
143-
]
144-
],
145-
"env": {
146-
"test": {
147-
"sourceMaps": "inline",
148-
"plugins": [
149-
[
150-
"transform-async-to-module-method",
151-
{
152-
"module": "bluebird-lst-c",
153-
"method": "coroutine"
154-
}
155-
],
156-
[
157-
"transform-inline-imports-commonjs",
158-
{
159-
"excludeModules": [
160-
"path"
161-
]
162-
}
163-
]
164-
]
165-
}
166-
}
167-
},
168123
"jest": {
169124
"testEnvironment": "node",
170125
"testPathDirs": [

src/appInfo.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DevMetadata, AppMetadata } from "./metadata"
1+
import { DevMetadata, AppMetadata, BuildMetadata } from "./metadata"
22
import { warn } from "./util/log"
33
import { smarten } from "./platformPackager"
44
import { isEmptyOrSpaces } from "./util/util"
@@ -15,10 +15,14 @@ export class AppInfo {
1515
readonly productName: string
1616
readonly productFilename: string
1717

18+
private get config(): BuildMetadata {
19+
return this.devMetadata.build
20+
}
21+
1822
constructor(public metadata: AppMetadata, private devMetadata: DevMetadata, buildVersion?: string | null) {
1923
this.version = metadata.version!
2024

21-
this.buildNumber = (<any>this.devMetadata.build)["build-version"] || process.env.TRAVIS_BUILD_NUMBER || process.env.APPVEYOR_BUILD_NUMBER || process.env.CIRCLE_BUILD_NUM || process.env.BUILD_NUMBER
25+
this.buildNumber = (<any>this.config)["build-version"] || process.env.TRAVIS_BUILD_NUMBER || process.env.APPVEYOR_BUILD_NUMBER || process.env.CIRCLE_BUILD_NUM || process.env.BUILD_NUMBER
2226

2327
if (isEmptyOrSpaces(buildVersion)) {
2428
buildVersion = this.version
@@ -31,7 +35,7 @@ export class AppInfo {
3135
this.buildVersion = buildVersion!
3236
}
3337

34-
this.productName = getProductName(this.metadata, this.devMetadata)
38+
this.productName = this.config.productName || metadata.productName || metadata.name
3539
this.productFilename = sanitizeFileName(this.productName)
3640
}
3741

@@ -45,13 +49,13 @@ export class AppInfo {
4549
}
4650

4751
get id(): string {
48-
let appId = this.devMetadata.build["app-bundle-id"]
52+
let appId = this.config["app-bundle-id"]
4953
if (appId != null) {
5054
warn("app-bundle-id is deprecated, please use appId")
5155
}
5256

53-
if (this.devMetadata.build.appId != null) {
54-
appId = this.devMetadata.build.appId
57+
if (this.config.appId != null) {
58+
appId = this.config.appId
5559
}
5660

5761
const generateDefaultAppId = () => {
@@ -72,27 +76,20 @@ export class AppInfo {
7276
}
7377

7478
get copyright(): string {
75-
const copyright = this.devMetadata.build.copyright
79+
const copyright = this.config.copyright
7680
if (copyright != null) {
7781
return copyright
7882
}
7983
return `Copyright © ${new Date().getFullYear()} ${this.metadata.author!.name || this.productName}`
8084
}
8185

8286
async computePackageUrl(): Promise<string | null> {
83-
const url = this.metadata.homepage || this.devMetadata.homepage
87+
const url = this.metadata.homepage
8488
if (url != null) {
8589
return url
8690
}
8791

8892
const info = await getRepositoryInfo(this.metadata, this.devMetadata)
89-
if (info != null) {
90-
return `https://github.com/${info.user}/${info.project}`
91-
}
92-
return null
93+
return info == null ? null : `https://github.com/${info.user}/${info.project}`
9394
}
94-
}
95-
96-
function getProductName(metadata: AppMetadata, devMetadata: DevMetadata) {
97-
return devMetadata.build.productName || metadata.productName || metadata.name
9895
}

src/cli/install-app-deps.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /usr/bin/env node
2-
import { computeDefaultAppDirectory, getElectronVersion, use } from "../util/util"
2+
import { computeDefaultAppDirectory, getElectronVersion, use, getDirectoriesConfig } from "../util/util"
33
import { printErrorAndExit } from "../util/promise"
44
import * as path from "path"
55
import BluebirdPromise from "bluebird-lst-c"
@@ -19,7 +19,7 @@ async function main() {
1919

2020
const devMetadata: DevMetadata = await readPackageJson(devPackageFile)
2121
const results: Array<string> = await BluebirdPromise.all([
22-
computeDefaultAppDirectory(projectDir, use(devMetadata.directories, it => it!.app)),
22+
computeDefaultAppDirectory(projectDir, use(getDirectoriesConfig(devMetadata), it => it!.app)),
2323
getElectronVersion(devMetadata, devPackageFile)
2424
])
2525

0 commit comments

Comments
 (0)