-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Copy pathPlatformSpecificBuildOptions.ts
248 lines (207 loc) · 8.57 KB
/
PlatformSpecificBuildOptions.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
import { CompressionLevel, Publish, TargetConfiguration, TargetSpecificOptions } from "../core"
import { FileAssociation } from "./FileAssociation"
export interface FileSet {
/**
* The source path relative to and defaults to:
*
* - the [app directory](configuration.md#MetadataDirectories-app) for `files`,
* - the project directory for `extraResources` and `extraFiles`.
* If you don't use two-package.json structure and don't set custom app directory, app directory equals to project directory.
*/
from?: string
/**
* The destination path relative to and defaults to:
*
* - the asar archive root for `files`,
* - the app's content directory for `extraFiles`,
* - the app's resource directory for `extraResources`.
*/
to?: string
/**
* The [glob patterns](./file-patterns.md). Defaults to "**\/*"
*/
filter?: Array<string> | string
}
export interface AsarOptions {
/**
* Whether to automatically unpack executables files.
* @default true
*/
smartUnpack?: boolean
ordering?: string | null
}
export interface FilesBuildOptions {
/**
* A [glob patterns](./file-patterns.md) relative to the [app directory](configuration.md#MetadataDirectories-app), which specifies which files to include when copying files to create the package.
Defaults to:
```json
[
"**\/*",
"!**\/node_modules/*\/{CHANGELOG.md,README.md,README,readme.md,readme}",
"!**\/node_modules/*\/{test,__tests__,tests,powered-test,example,examples}",
"!**\/node_modules/*.d.ts",
"!**\/node_modules/.bin",
"!**\/*.{iml,o,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,xproj}",
"!.editorconfig",
"!**\/._*",
"!**\/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,.gitignore,.gitattributes}",
"!**\/{__pycache__,thumbs.db,.flowconfig,.idea,.vs,.nyc_output}",
"!**\/{appveyor.yml,.travis.yml,circle.yml}",
"!**\/{npm-debug.log,yarn.lock,.yarn-integrity,.yarn-metadata.json}"
]
```
Development dependencies are never copied in any case. You don't need to ignore it explicitly. Hidden files are not ignored by default, but all files that should be ignored, are ignored by default.
Default pattern \`**\/*\` **is not added to your custom** if some of your patterns is not ignore (i.e. not starts with `!`). `package.json` and \`**\/node_modules/**\/*` (only production dependencies will be copied) is added to your custom in any case. All default ignores are added in any case — you don't need to repeat it if you configure own patterns.
May be specified in the platform options (e.g. in the [mac](mac.md)).
You may also specify custom source and destination directories by using `FileSet` objects instead of simple glob patterns.
```json
[
{
"from": "path/to/source",
"to": "path/to/destination",
"filter": ["**\/*", "!foo/*.js"]
}
]
```
You can use [file macros](./file-patterns.md#file-macros) in the `from` and `to` fields as well. `from` and `to` can be files and you can use this to [rename](https://github.com/electron-userland/electron-builder/issues/1119) a file while packaging.
*/
files?: Array<FileSet | string> | FileSet | string | null
/**
* A [glob patterns](./file-patterns.md) relative to the project directory, when specified, copy the file or directory with matching names directly into the app's resources directory (`Contents/Resources` for MacOS, `resources` for Linux and Windows).
*
* File patterns (and support for `from` and `to` fields) the same as for [files](#files).
*
*/
extraResources?: Array<FileSet | string> | FileSet | string | null
/**
* The same as [extraResources](#extraresources) but copy into the app's content directory (`Contents` for MacOS, root directory for Linux and Windows).
*/
extraFiles?: Array<FileSet | string> | FileSet | string | null
}
export interface PlatformSpecificBuildOptions extends TargetSpecificOptions, FilesBuildOptions {
/**
* 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 (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.
* @default com.electron.${name}
*/
readonly appId?: string | null
/**
* The [artifact file name template](./configuration.md#artifact-file-name-template). Defaults to `${productName}-${version}.${ext}` (some target can have other defaults, see corresponding options).
*/
readonly artifactName?: string | null
/**
* The executable name. Defaults to `productName`.
*/
readonly executableName?: string | null
/**
* The compression level. If you want to rapidly test build, `store` can reduce build time significantly. `maximum` doesn't lead to noticeable size difference, but increase build time.
* @default normal
*/
readonly compression?: CompressionLevel | null
/**
* Whether to exclude all default ignored files(https://www.electron.build/contents#files) and options. Defaults to `false`.
*
* @default false
*/
disableDefaultIgnoredFiles?: boolean | null
/**
* Whether to package the application's source code into an archive, using [Electron's archive format](http://electron.atom.io/docs/tutorial/application-packaging/).
*
* Node modules, that must be unpacked, will be detected automatically, you don't need to explicitly set [asarUnpack](#configuration-asarUnpack) - please file an issue if this doesn't work.
* @default true
*/
readonly asar?: AsarOptions | boolean | null
/**
* A [glob patterns](./file-patterns.md) relative to the [app directory](#MetadataDirectories-app), which specifies which files to unpack when creating the [asar](http://electron.atom.io/docs/tutorial/application-packaging/) archive.
*/
readonly asarUnpack?: Array<string> | string | null
/* - @private */
readonly icon?: string | null
/**
* The file associations.
*/
readonly fileAssociations?: Array<FileAssociation> | FileAssociation
/**
* The URL protocol schemes.
*/
readonly protocols?: Array<Protocol> | Protocol
/**
* The electron locales to keep. By default, all Electron locales used as-is.
*/
readonly electronLanguages?: Array<string> | string
/**
* Whether to fail if app will be not code signed.
*/
readonly forceCodeSigning?: boolean
/**
* The [electron-updater compatibility](./auto-update.md#compatibility) semver range.
*/
readonly electronUpdaterCompatibility?: string | null
publish?: Publish
/**
* Whether to infer update channel from application version pre-release components. e.g. if version `0.12.1-alpha.1`, channel will be set to `alpha`. Otherwise to `latest`.
* @default true
*/
readonly detectUpdateChannel?: boolean
/**
* Please see [Building and Releasing using Channels](https://github.com/electron-userland/electron-builder/issues/1182#issuecomment-324947139).
* @default false
*/
readonly generateUpdatesFilesForAllChannels?: boolean
/**
* The release info. Intended for command line usage:
*
* ```
* -c.releaseInfo.releaseNotes="new features"
* ```
*/
readonly releaseInfo?: ReleaseInfo
readonly target?: Array<string | TargetConfiguration> | string | TargetConfiguration | null
/* - @private */
cscLink?: string | null
/* - @private */
cscKeyPassword?: string | null
readonly defaultArch?: string
}
export interface ReleaseInfo {
/**
* The release name.
*/
releaseName?: string | null
/**
* The release notes.
*/
releaseNotes?: string | null
/**
* The path to release notes file. Defaults to `release-notes-${platform}.md` (where `platform` it is current platform — `mac`, `linux` or `windows`) or `release-notes.md` in the [build resources](#MetadataDirectories-buildResources).
*/
releaseNotesFile?: string | null
/**
* The release date.
*/
releaseDate?: string
/**
* Vendor specific information.
*/
vendor?: { [key: string]: any } | null
}
/**
* URL Protocol Schemes. Protocols to associate the app with. macOS only.
*
* Please note — on macOS [you need to register an `open-url` event handler](http://electron.atom.io/docs/api/app/#event-open-url-macos).
*/
export interface Protocol {
/**
* The name. e.g. `IRC server URL`.
*/
readonly name: string
/**
* The schemes. e.g. `["irc", "ircs"]`.
*/
readonly schemes: Array<string>
/**
* *macOS-only* The app’s role with respect to the type.
* @default Editor
*/
readonly role?: "Editor" | "Viewer" | "Shell" | "None"
}