Skip to content

Commit 9a711d9

Browse files
committed
Extracted out electron-builder config into function that generates platform-specific config
1 parent 8e4d16b commit 9a711d9

File tree

3 files changed

+204
-126
lines changed

3 files changed

+204
-126
lines changed

packages/app/main/package.json

Lines changed: 0 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -165,130 +165,5 @@
165165
"tslib": "^1.9.0",
166166
"ws": "^5.0.0",
167167
"xmldom": "^0.1.27"
168-
},
169-
"build": {
170-
"asar": true,
171-
"appId": "F3C061A6-FE81-4548-82ED-C1171D9856BB",
172-
"productName": "Bot Framework Emulator",
173-
"copyright": "Copyright © 2018 Microsoft Corporation",
174-
"electronDist": "customElectron",
175-
"protocols": [
176-
{
177-
"name": "Bot Framework Emulator",
178-
"role": "Viewer",
179-
"schemes": [
180-
"bfemulator"
181-
]
182-
}
183-
],
184-
"fileAssociations": [
185-
{
186-
"name": "Bot",
187-
"ext": "bot"
188-
},
189-
{
190-
"name": "Transcript",
191-
"ext": "transcript"
192-
}
193-
],
194-
"asarUnpack": [
195-
"app/extensions/**",
196-
"node_modules/@bfemulator/extension-*/**"
197-
],
198-
"directories": {
199-
"buildResources": "./scripts/config/resources"
200-
},
201-
"files": [
202-
"**/*",
203-
"!**/node_modules/*/{README.md,README,readme.md,readme,test}",
204-
"!**/node_modules/.bin",
205-
"!**/*.{o,hprof,orig,pyc,pyo,rbc}",
206-
"!**/._*",
207-
"!**/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,__pycache__,thumbs.db,.gitignore,.gitattributes,.editorconfig,.idea,appveyor.yml,.travis.yml,circle.yml,.babelrc,.eslintignore,.eslintrc.js,.prettierrc,.eslintrc.react.js,.node-version}",
208-
"!.vscode${/*}",
209-
"!doc${/*}",
210-
"!**/{tsconfig.json,README.md,getlicenses.cmd}",
211-
"!**/node_modules/@types",
212-
"!./scripts",
213-
"!**/cache",
214-
"!./installer"
215-
],
216-
"win": {
217-
"artifactName": "BotFramework-Emulator-${version}-windows-setup.${ext}",
218-
"icon": "./scripts/config/resources/icon.ico",
219-
"target": [
220-
{
221-
"target": "nsis",
222-
"arch": [
223-
"ia32"
224-
]
225-
}
226-
]
227-
},
228-
"nsis": {
229-
"include": "./scripts/config/resources/nsis/installer.nsh",
230-
"perMachine": false,
231-
"allowElevation": true,
232-
"allowToChangeInstallationDirectory": true,
233-
"packElevateHelper": true,
234-
"unicode": true,
235-
"runAfterFinish": true,
236-
"installerHeader": "./scripts/config/resources/nsis/installerHeader.bmp",
237-
"installerIcon": "./scripts/config/resources/icon.ico",
238-
"installerSidebar": "./scripts/config/resources/nsis/installerSidebar.bmp",
239-
"uninstallerIcon": "./scripts/config/resources/icon.ico",
240-
"uninstallerSidebar": "./scripts/config/resources/nsis/installerSidebar.bmp",
241-
"createDesktopShortcut": true,
242-
"createStartMenuShortcut": true,
243-
"shortcutName": "Bot Framework Emulator (V4)",
244-
"oneClick": false
245-
},
246-
"mac": {
247-
"artifactName": "BotFramework-Emulator-${version}-mac.${ext}",
248-
"category": "public.app-category.developer-tools",
249-
"target": [
250-
{
251-
"target": "dmg",
252-
"arch": [
253-
"x64"
254-
]
255-
}
256-
],
257-
"extendInfo": {
258-
"NSMicrophoneUsageDescription": "This app requires microphone access to record audio."
259-
},
260-
"entitlements": "./scripts/config/resources/entitlements.plist"
261-
},
262-
"dmg": {
263-
"background": "./scripts/config/resources/background.tiff",
264-
"icon": "./scripts/config/resources/emulator_dmg.icns",
265-
"title": "Bot Framework Emulator Installer",
266-
"contents": [
267-
{
268-
"x": 140,
269-
"y": 244
270-
},
271-
{
272-
"x": 380,
273-
"y": 244,
274-
"type": "link",
275-
"path": "/Applications"
276-
}
277-
]
278-
},
279-
"linux": {
280-
"artifactName": "BotFramework-Emulator-${version}-${platform}-${arch}.${ext}",
281-
"category": "Development",
282-
"target": [
283-
{
284-
"target": "AppImage",
285-
"arch": [
286-
"x64"
287-
]
288-
}
289-
]
290-
},
291-
"publish": null,
292-
"remoteBuild": false
293168
}
294169
}
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
//
2+
// Copyright (c) Microsoft. All rights reserved.
3+
// Licensed under the MIT license.
4+
//
5+
// Microsoft Bot Framework: http://botframework.com
6+
//
7+
// Bot Framework Emulator Github:
8+
// https://github.com/Microsoft/BotFramwork-Emulator
9+
//
10+
// Copyright (c) Microsoft Corporation
11+
// All rights reserved.
12+
//
13+
// MIT License:
14+
// Permission is hereby granted, free of charge, to any person obtaining
15+
// a copy of this software and associated documentation files (the
16+
// "Software"), to deal in the Software without restriction, including
17+
// without limitation the rights to use, copy, modify, merge, publish,
18+
// distribute, sublicense, and/or sell copies of the Software, and to
19+
// permit persons to whom the Software is furnished to do so, subject to
20+
// the following conditions:
21+
//
22+
// The above copyright notice and this permission notice shall be
23+
// included in all copies or substantial portions of the Software.
24+
//
25+
// THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND,
26+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29+
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32+
//
33+
34+
const packageJson = require('../../package.json');
35+
const electronVersion = packageJson.devDependencies.electron;
36+
37+
const baseConfig = {
38+
asar: true,
39+
appId: 'F3C061A6-FE81-4548-82ED-C1171D9856BB',
40+
productName: 'Bot Framework Emulator',
41+
copyright: 'Copyright © 2018 Microsoft Corporation',
42+
protocols: [
43+
{
44+
name: 'Bot Framework Emulator',
45+
role: 'Viewer',
46+
schemes: ['bfemulator'],
47+
},
48+
],
49+
fileAssociations: [
50+
{
51+
name: 'Bot',
52+
ext: 'bot',
53+
},
54+
{
55+
name: 'Transcript',
56+
ext: 'transcript',
57+
},
58+
],
59+
asarUnpack: ['app/extensions/**', 'node_modules/@bfemulator/extension-*/**'],
60+
directories: {
61+
buildResources: './scripts/config/resources',
62+
},
63+
files: [
64+
'**/*',
65+
'!**/node_modules/*/{README.md,README,readme.md,readme,test}',
66+
'!**/node_modules/.bin',
67+
'!**/*.{o,hprof,orig,pyc,pyo,rbc}',
68+
'!**/._*',
69+
'!**/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,__pycache__,thumbs.db,.gitignore,.gitattributes,.editorconfig,.idea,appveyor.yml,.travis.yml,circle.yml,.babelrc,.eslintignore,.eslintrc.js,.prettierrc,.eslintrc.react.js,.node-version}',
70+
'!.vscode${/*}',
71+
'!doc${/*}',
72+
'!**/{tsconfig.json,README.md,getlicenses.cmd}',
73+
'!**/node_modules/@types',
74+
'!./scripts',
75+
'!**/cache',
76+
'!./installer',
77+
],
78+
win: {
79+
artifactName: 'BotFramework-Emulator-${version}-windows-setup.${ext}',
80+
icon: './scripts/config/resources/icon.ico',
81+
target: [
82+
{
83+
target: 'nsis',
84+
arch: ['ia32'],
85+
},
86+
],
87+
},
88+
nsis: {
89+
include: './scripts/config/resources/nsis/installer.nsh',
90+
perMachine: false,
91+
allowElevation: true,
92+
allowToChangeInstallationDirectory: true,
93+
packElevateHelper: true,
94+
unicode: true,
95+
runAfterFinish: true,
96+
installerHeader: './scripts/config/resources/nsis/installerHeader.bmp',
97+
installerIcon: './scripts/config/resources/icon.ico',
98+
installerSidebar: './scripts/config/resources/nsis/installerSidebar.bmp',
99+
uninstallerIcon: './scripts/config/resources/icon.ico',
100+
uninstallerSidebar: './scripts/config/resources/nsis/installerSidebar.bmp',
101+
createDesktopShortcut: true,
102+
createStartMenuShortcut: true,
103+
shortcutName: 'Bot Framework Emulator (V4)',
104+
oneClick: false,
105+
},
106+
mac: {
107+
artifactName: 'BotFramework-Emulator-${version}-mac.${ext}',
108+
category: 'public.app-category.developer-tools',
109+
target: [
110+
{
111+
target: 'dmg',
112+
arch: ['x64'],
113+
},
114+
],
115+
extendInfo: {
116+
NSMicrophoneUsageDescription: 'This app requires microphone access to record audio.',
117+
},
118+
entitlements: './scripts/config/resources/entitlements.plist',
119+
},
120+
dmg: {
121+
background: './scripts/config/resources/background.tiff',
122+
icon: './scripts/config/resources/emulator_dmg.icns',
123+
title: 'Bot Framework Emulator Installer',
124+
contents: [
125+
{
126+
x: 140,
127+
y: 244,
128+
},
129+
{
130+
x: 380,
131+
y: 244,
132+
type: 'link',
133+
path: '/Applications',
134+
},
135+
],
136+
},
137+
linux: {
138+
artifactName: 'BotFramework-Emulator-${version}-${platform}-${arch}.${ext}',
139+
category: 'Development',
140+
target: [
141+
{
142+
target: 'AppImage',
143+
arch: ['x64'],
144+
},
145+
],
146+
},
147+
publish: null,
148+
remoteBuild: false,
149+
};
150+
151+
export default () => {
152+
if (process.platform === 'win32') {
153+
// on Windows we need to manually download the internal Electron binary
154+
// and then unsign it before packing it up to be signed
155+
return {
156+
...baseConfig,
157+
electronDist: 'customElectron',
158+
};
159+
} else {
160+
// on Mac and Linux we will download the internal Electron binary as-is
161+
// during the electron-builder pack call
162+
return {
163+
...baseConfig,
164+
electronDownload: {
165+
version: electronVersion,
166+
},
167+
};
168+
}
169+
};

packages/app/main/scripts/downloadAndExtractElectron.js

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,40 @@
1+
//
2+
// Copyright (c) Microsoft. All rights reserved.
3+
// Licensed under the MIT license.
4+
//
5+
// Microsoft Bot Framework: http://botframework.com
6+
//
7+
// Bot Framework Emulator Github:
8+
// https://github.com/Microsoft/BotFramwork-Emulator
9+
//
10+
// Copyright (c) Microsoft Corporation
11+
// All rights reserved.
12+
//
13+
// MIT License:
14+
// Permission is hereby granted, free of charge, to any person obtaining
15+
// a copy of this software and associated documentation files (the
16+
// "Software"), to deal in the Software without restriction, including
17+
// without limitation the rights to use, copy, modify, merge, publish,
18+
// distribute, sublicense, and/or sell copies of the Software, and to
19+
// permit persons to whom the Software is furnished to do so, subject to
20+
// the following conditions:
21+
//
22+
// The above copyright notice and this permission notice shall be
23+
// included in all copies or substantial portions of the Software.
24+
//
25+
// THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND,
26+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29+
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32+
//
33+
34+
const { join } = require('path');
35+
136
const { download } = require('@electron/get');
237
const extract = require('extract-zip');
3-
const { join } = require('path');
438

539
const packageJson = require('../package.json');
640
const electronVersion = packageJson.devDependencies.electron;

0 commit comments

Comments
 (0)