Skip to content

Commit 6a906ac

Browse files
committed
feat: remove OriginalFilename, add LegalTrademarks, add ProductVersion for NSIS
Closes #655
1 parent 50d27bf commit 6a906ac

23 files changed

+162
-128
lines changed

.idea/dictionaries/develar.xml

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ For a production app you need to sign your application, see [Where to buy code s
5252
```json
5353
"build": {
5454
"appId": "your.id",
55-
"app-category-type": "your.app.category.type",
55+
"category": "your.app.category.type",
5656
"win": {
5757
"iconUrl": "(windows-only) https link to icon"
5858
}

docs/Multi Platform Build.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Use [brew](http://brew.sh) to install required packages.
2626

2727
### To build app for Windows on MacOS:
2828
```
29-
brew install Caskroom/cask/xquartz wine mono
29+
brew install wine --with-win64 --without-x11 --devel
30+
brew install mono
3031
```
3132

3233
### To build app for Linux on MacOS:

docs/Options.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,14 @@ Here documented only `electron-builder` specific options:
5151
| Name | Description
5252
| --- | ---
5353
| appId | <a name="BuildMetadata-appId"></a><p>The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as [Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows.</p> <p>For windows only NSIS target supports it. Squirrel.Windows is not fixed yet.</p> <p>Defaults to <code>com.electron.${name}</code>. It is strongly recommended that an explicit ID be set.</p>
54-
| app-category-type | <a name="BuildMetadata-app-category-type"></a><p>*macOS-only.* The application category type, as shown in the Finder via *View -&gt; Arrange by Application Category* when viewing the Applications directory.</p> <p>For example, <code>app-category-type=public.app-category.developer-tools</code> will set the application category to *Developer Tools*.</p> <p>Valid values are listed in [Apple’s documentation](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8).</p>
55-
| asar | <a name="BuildMetadata-asar"></a><p>Whether to package the application’s source code into an archive, using [Electron’s archive format](https://github.com/electron/asar). Defaults to <code>true</code>. Reasons why you may want to disable this feature are described in [an application packaging tutorial in Electron’s documentation](http://electron.atom.io/docs/latest/tutorial/application-packaging/#limitations-on-node-api/).</p> <p>Or you can pass object of any asar options.</p> <p>electron-builder detects node modules that must be unpacked automatically, you don’t need to explicitly set <code>asar.unpackDir</code> - please file issue if this doesn’t work.</p>
54+
| category | <a name="BuildMetadata-category"></a><p>*macOS-only.* The application category type, as shown in the Finder via *View -&gt; Arrange by Application Category* when viewing the Applications directory.</p> <p>For example, <code>&quot;category&quot;: &quot;public.app-category.developer-tools&quot;</code> will set the application category to *Developer Tools*.</p> <p>Valid values are listed in [Apple’s documentation](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8).</p>
55+
| copyright | <a name="BuildMetadata-copyright"></a>The human-readable copyright line for the app. Defaults to `Copyright © year author`.
56+
| asar | <a name="BuildMetadata-asar"></a><p>Whether to package the application’s source code into an archive, using [Electron’s archive format](https://github.com/electron/asar). Defaults to <code>true</code>. Reasons why you may want to disable this feature are described in [an application packaging tutorial in Electron’s documentation](http://electron.atom.io/docs/latest/tutorial/application-packaging/#limitations-on-node-api/).</p> <p>Or you can pass object of any asar options.</p> <p>Node modules, that must be unpacked, will be detected automatically, you don’t need to explicitly set <code>asar.unpackDir</code> - please file issue if this doesn’t work.</p>
5657
| productName | <a name="BuildMetadata-productName"></a>See [AppMetadata.productName](#AppMetadata-productName).
5758
| files | <a name="BuildMetadata-files"></a><p>A [glob patterns](https://www.npmjs.com/package/glob#glob-primer) relative to the [app directory](#MetadataDirectories-app), which specifies which files to include when copying files to create the package.</p> <p>See [File Patterns](#multiple-glob-patterns).</p>
5859
| extraResources | <a name="BuildMetadata-extraResources"></a><p>A [glob patterns](https://www.npmjs.com/package/glob#glob-primer) relative to the project directory, when specified, copy the file or directory with matching names directly into the app’s resources directory (<code>Contents/Resources</code> for MacOS, <code>resources</code> for Linux/Windows).</p> <p>Glob rules the same as for [files](#multiple-glob-patterns).</p>
5960
| extraFiles | <a name="BuildMetadata-extraFiles"></a>The same as [extraResources](#BuildMetadata-extraResources) but copy into the app's content directory (`Contents` for MacOS, root directory for Linux/Windows).
61+
| fileAssociations | <a name="BuildMetadata-fileAssociations"></a>File associations. See [.build.fileAssociations](#FileAssociation).
6062
| mac | <a name="BuildMetadata-mac"></a>See [.build.mac](#MacOptions).
6163
| dmg | <a name="BuildMetadata-dmg"></a>See [.build.dmg](#DmgOptions).
6264
| mas | <a name="BuildMetadata-mas"></a>See [.build.mas](#MasBuildOptions).
@@ -66,7 +68,6 @@ Here documented only `electron-builder` specific options:
6668
| compression | <a name="BuildMetadata-compression"></a>The compression level, one of `store`, `normal`, `maximum` (default: `normal`). If you want to rapidly test build, `store` can reduce build time significantly.
6769
| afterPack | <a name="BuildMetadata-afterPack"></a>*programmatic API only* The function to be run after pack (but before pack into distributable format and sign). Promise must be returned.
6870
| npmRebuild | <a name="BuildMetadata-npmRebuild"></a>Whether to [rebuild](https://docs.npmjs.com/cli/rebuild) native dependencies (`npm rebuild`) before starting to package the app. Defaults to `true`.
69-
| fileAssociations | <a name="BuildMetadata-fileAssociations"></a>File associations. (NSIS only for now).
7071

7172
<a name="MacOptions"></a>
7273
### `.build.mac`
@@ -119,6 +120,7 @@ Windows specific build options.
119120
| remoteToken | <a name="WinBuildOptions-remoteToken"></a>*Squirrel.Windows-only.* Authentication token for remote updates
120121
| signingHashAlgorithms | <a name="WinBuildOptions-signingHashAlgorithms"></a>Array of signing algorithms used. Defaults to `['sha1', 'sha256']`
121122
| icon | <a name="WinBuildOptions-icon"></a>The path to application icon. Defaults to `build/icon.ico` (consider using this convention instead of complicating your configuration).
123+
| legalTrademarks | <a name="WinBuildOptions-legalTrademarks"></a>The trademarks and registered trademarks.
122124

123125
<a name="NsisOptions"></a>
124126
### `.build.nsis`

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"lint": "tslint 'src/**/*.ts' 'test/src/**/*.ts'",
2424
"pretest": "npm run compile && npm run lint",
2525
"test": "node ./test/out/helpers/runTests.js",
26-
"semantic-release": "semantic-release pre && cd nsis-auto-updater && npm install --production && cd .. && npm publish && semantic-release post",
26+
"semantic-release": "semantic-release pre && cd nsis-auto-updater && npm install --production && npm prune && cd .. && npm publish && semantic-release post",
2727
"//": "Update wiki if docs changed. Update only if functionalily are generally available (latest release, not next)",
2828
"update-wiki": "git subtree split -b wiki --prefix docs/ && git push -f wiki wiki:master",
2929
"whitespace": "whitespace 'src/**/*.ts'",
@@ -69,7 +69,7 @@
6969
"debug": "^2.2.0",
7070
"electron-download": "^2.1.2",
7171
"electron-osx-sign": "^0.4.0-beta4",
72-
"electron-winstaller-fixed": "~3.1.0",
72+
"electron-winstaller-fixed": "~4.0.0",
7373
"extract-zip": "^1.5.0",
7474
"fs-extra-p": "^1.0.6",
7575
"hosted-git-info": "^2.1.5",
@@ -84,7 +84,6 @@
8484
"pretty-ms": "^2.1.0",
8585
"progress": "^1.1.8",
8686
"progress-stream": "^1.2.0",
87-
"rcedit": "^0.5.1",
8887
"sanitize-filename": "^1.6.0",
8988
"semver": "^5.3.0",
9089
"source-map-support": "^0.4.2",
@@ -110,7 +109,7 @@
110109
"@types/progress": "^1.1.27",
111110
"@types/semver": "^5.3.28",
112111
"@types/source-map-support": "^0.2.27",
113-
"ava-tf": "^0.15.4",
112+
"ava-tf": "^0.16.0",
114113
"babel-plugin-array-includes": "^2.0.3",
115114
"babel-plugin-transform-es2015-destructuring": "^6.9.0",
116115
"babel-plugin-transform-es2015-parameters": "^6.11.4",

src/appInfo.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,6 @@ const __awaiter = require("./util/awaiter")
1010

1111
export class AppInfo {
1212
readonly description = smarten(this.metadata.description!)
13-
14-
// windows-only
15-
versionString = {
16-
CompanyName: this.companyName,
17-
FileDescription: this.description,
18-
ProductName: this.productName,
19-
InternalName: this.productName,
20-
LegalCopyright: this.copyright,
21-
}
22-
2313
readonly version: string
2414
readonly buildNumber: string
2515
readonly buildVersion: string
@@ -69,12 +59,27 @@ export class AppInfo {
6959
return this.metadata.name
7060
}
7161

62+
get category() {
63+
const metadata = this.devMetadata.build
64+
const old = (<any>metadata)["app-category-type"]
65+
if (old != null) {
66+
warn('"app-category-type" is deprecated — please use "category" instead')
67+
}
68+
return metadata.category || old
69+
}
70+
7271
get productName(): string {
7372
return getProductName(this.metadata, this.devMetadata)
7473
}
7574

7675
get copyright(): string {
77-
const copyright = (<any>this.devMetadata.build)["app-copyright"]
76+
const metadata = this.devMetadata.build
77+
const old = (<any>metadata)["app-copyright"]
78+
if (old != null) {
79+
warn('"app-copyright" is deprecated — please use "copyright" instead')
80+
}
81+
82+
const copyright = metadata.copyright || old
7883
if (copyright != null) {
7984
return copyright
8085
}

src/errorMessages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export const buildIsMissed = `Please specify 'build' configuration in the develo
22
33
build: {
44
"appId": "your.id",
5-
"app-category-type": "your.app.category.type"
5+
"category": "your.app.category.type"
66
}
77
}
88

src/linuxPackager.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import FpmTarget from "./targets/fpm"
66
import { createCommonTarget, DEFAULT_TARGET } from "./targets/targetFactory"
77
import { LinuxTargetHelper } from "./targets/LinuxTargetHelper"
88
import AppImageTarget from "./targets/appImage"
9+
import { rename } from "fs-extra-p"
910

1011
//noinspection JSUnusedLocalSymbols
1112
const __awaiter = require("./util/awaiter")
@@ -65,6 +66,10 @@ export class LinuxPackager extends PlatformPackager<LinuxBuildOptions> {
6566
postAsyncTasks.push(this.packageInDistributableFormat(outDir, appOutDir, arch, targets))
6667
}
6768

69+
protected postInitApp(appOutDir: string): Promise<any> {
70+
return rename(path.join(appOutDir, "electron"), path.join(appOutDir, this.appInfo.productFilename))
71+
}
72+
6873
protected async packageInDistributableFormat(outDir: string, appOutDir: string, arch: Arch, targets: Array<Target>): Promise<any> {
6974
// todo fix fpm - if run in parallel, get strange tar errors
7075
for (let t of targets) {

src/metadata.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,25 +93,27 @@ export interface BuildMetadata {
9393
*/
9494
readonly appId?: string | null
9595

96-
// deprecated
97-
readonly "app-bundle-id"?: string | null
98-
9996
/*
10097
*macOS-only.* The application category type, as shown in the Finder via *View -> Arrange by Application Category* when viewing the Applications directory.
10198
102-
For example, `app-category-type=public.app-category.developer-tools` will set the application category to *Developer Tools*.
99+
For example, `"category": "public.app-category.developer-tools"` will set the application category to *Developer Tools*.
103100
104101
Valid values are listed in [Apple's documentation](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8).
105102
*/
106-
readonly "app-category-type"?: string | null
103+
readonly category?: string | null
104+
105+
/*
106+
The human-readable copyright line for the app. Defaults to `Copyright © year author`.
107+
*/
108+
readonly copyright?: string | null
107109

108110
/*
109111
Whether to package the application's source code into an archive, using [Electron's archive format](https://github.com/electron/asar). Defaults to `true`.
110112
Reasons why you may want to disable this feature are described in [an application packaging tutorial in Electron's documentation](http://electron.atom.io/docs/latest/tutorial/application-packaging/#limitations-on-node-api/).
111113
112114
Or you can pass object of any asar options.
113115
114-
electron-builder detects node modules that must be unpacked automatically, you don't need to explicitly set `asar.unpackDir` - please file issue if this doesn't work.
116+
Node modules, that must be unpacked, will be detected automatically, you don't need to explicitly set `asar.unpackDir` - please file issue if this doesn't work.
115117
*/
116118
readonly asar?: AsarOptions | boolean | null
117119

@@ -142,6 +144,11 @@ export interface BuildMetadata {
142144
*/
143145
readonly extraFiles?: Array<string> | string | null
144146

147+
/*
148+
File associations. See [.build.fileAssociations](#FileAssociation).
149+
*/
150+
readonly fileAssociations?: Array<FileAssociation> | FileAssociation
151+
145152
/*
146153
See [.build.mac](#MacOptions).
147154
*/
@@ -194,10 +201,8 @@ export interface BuildMetadata {
194201

195202
readonly icon?: string | null
196203

197-
/*
198-
File associations. (NSIS only for now).
199-
*/
200-
readonly fileAssociations?: Array<FileAssociation> | FileAssociation
204+
// deprecated
205+
readonly "app-bundle-id"?: string | null
201206
}
202207

203208
export interface AfterPackContext {
@@ -335,14 +340,18 @@ export interface WinBuildOptions extends PlatformSpecificBuildOptions {
335340
Array of signing algorithms used. Defaults to `['sha1', 'sha256']`
336341
*/
337342
readonly signingHashAlgorithms?: Array<string> | null
338-
readonly signcodePath?: string | null
339343

340344
/*
341345
The path to application icon. Defaults to `build/icon.ico` (consider using this convention instead of complicating your configuration).
342346
*/
343347
readonly icon?: string | null
344348

345349
readonly fileAssociations?: Array<FileAssociation> | FileAssociation
350+
351+
/*
352+
The trademarks and registered trademarks.
353+
*/
354+
readonly legalTrademarks?: string | null
346355
}
347356

348357
/*

src/packager/dirPackager.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { Promise as BluebirdPromise } from "bluebird"
2-
import { emptyDir, rename } from "fs-extra-p"
2+
import { emptyDir } from "fs-extra-p"
33
import { warn } from "../util/log"
44
import { AppInfo } from "../appInfo"
5-
import * as path from "path"
65

76
const downloadElectron: (options: any) => Promise<any> = BluebirdPromise.promisify(require("electron-download"))
87
const extract: any = BluebirdPromise.promisify(require("extract-zip"))
@@ -12,7 +11,6 @@ const __awaiter = require("../util/awaiter")
1211

1312
export interface ElectronPackagerOptions {
1413
"extend-info"?: string
15-
"app-category-type"?: string
1614

1715
protocols?: any
1816

@@ -25,13 +23,6 @@ export interface ElectronPackagerOptions {
2523
ignore?: any
2624
}
2725

28-
const supportedPlatforms: any = {
29-
// Maps to module ID for each platform (lazy-required if used)
30-
darwin: "./mac",
31-
mas: "./mac", // map to darwin
32-
win32: "./win32"
33-
}
34-
3526
function createDownloadOpts(opts: any, platform: string, arch: string, electronVersion: string) {
3627
const downloadOpts = Object.assign({
3728
cache: opts.cache,
@@ -58,13 +49,10 @@ export async function pack(opts: ElectronPackagerOptions, out: string, platform:
5849
]))[0]
5950
await extract(zipPath, {dir: out})
6051

61-
if (platform === "linux") {
62-
await BluebirdPromise.all([
63-
initializeApp(),
64-
rename(path.join(out, "electron"), path.join(out, opts.appInfo.productFilename))
65-
])
52+
if (platform === "darwin" || platform === "mas") {
53+
await(<any>require("./mac")).createApp(opts, out, initializeApp)
6654
}
6755
else {
68-
await (<any>require(supportedPlatforms[platform])).createApp(opts, out, initializeApp)
56+
await initializeApp()
6957
}
7058
}

0 commit comments

Comments
 (0)