Skip to content

Commit 05654da

Browse files
committed
Start trying to build for Windows with electron-builder
1 parent b8ed1dd commit 05654da

File tree

8 files changed

+30
-135
lines changed

8 files changed

+30
-135
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@ on: push
33
jobs:
44
build:
55
name: Build & test
6-
runs-on: ubuntu-latest
7-
container: httptoolkit/act-build-base
6+
strategy:
7+
matrix:
8+
os: [
9+
"ubuntu-18.04",
10+
"windows-2019"
11+
]
12+
runs-on: ${{ matrix.os }}
813
steps:
914
- uses: actions/checkout@v2
1015

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ build/
44
dist/
55
httptoolkit-server/
66
appveyor-tools/
7-
certificates/encrypted-win-cert.pfx
-3.02 KB
Binary file not shown.

electron-forge.config.js

Lines changed: 0 additions & 86 deletions
This file was deleted.

package-lock.json

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

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
"extraResources": [
4848
"httptoolkit-server/**/*"
4949
],
50+
"win": {
51+
"target": ["nsis"],
52+
"icon": "./src/icon.ico",
53+
"forceCodeSigning": true
54+
},
5055
"linux": {
5156
"target": [
5257
"deb"
@@ -70,7 +75,6 @@
7075
"@sentry/electron": "^0.17.1",
7176
"electron-context-menu": "^0.15.1",
7277
"electron-first-run": "^3.0.0",
73-
"electron-squirrel-startup": "^1.0.0",
7478
"electron-window-state": "^5.0.3",
7579
"rimraf": "^2.7.1",
7680
"semver": "^7.2.1",

src/index.ts

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -400,26 +400,18 @@ if (!amMainInstance) {
400400

401401
reportStartupEvents();
402402

403-
if (require('electron-squirrel-startup')) {
404-
// We've been opened as part of a Windows install.
405-
// squirrel-startup handles all the hard work, we just need to not do anything.
406-
407-
// Brief delay before quitting, so our analytics register
408-
setTimeout(() => app.quit(), 500);
409-
} else {
410-
cleanupOldServers().catch(console.log)
411-
.then(() => startServer())
412-
.catch((err) => {
413-
console.error('Failed to start server, exiting.', err);
414-
415-
// Hide immediately, shutdown entirely after a brief pause for Sentry
416-
windows.forEach(window => window.hide());
417-
setTimeout(() => process.exit(1), 500);
418-
});
403+
cleanupOldServers().catch(console.log)
404+
.then(() => startServer())
405+
.catch((err) => {
406+
console.error('Failed to start server, exiting.', err);
407+
408+
// Hide immediately, shutdown entirely after a brief pause for Sentry
409+
windows.forEach(window => window.hide());
410+
setTimeout(() => process.exit(1), 500);
411+
});
419412

420-
app.on('ready', () => createWindow());
421-
// We use a single process instance to manage the server, but we
422-
// do allow multiple windows.
423-
app.on('second-instance', () => createWindow());
424-
}
413+
app.on('ready', () => createWindow());
414+
// We use a single process instance to manage the server, but we
415+
// do allow multiple windows.
416+
app.on('second-instance', () => createWindow());
425417
}

src/report-install-event.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,14 @@ import * as isFirstRun from 'electron-first-run';
22
import * as setupUA from 'universal-analytics';
33

44
/*
5-
This file tracks some basic metric on app installs, uninstalls
6-
and usage. All of this is anonymous, and nothing user identifiable
5+
This file tracks some basic metric on app first run.
6+
All of this is anonymous, and nothing user identifiable
77
is sent, it's only used to get an idea of real world app usage.
88
*/
99

1010
export function reportStartupEvents() {
1111
const analytics = setupUA('UA-117670723-2');
1212

13-
if (process.platform === 'win32') {
14-
const cmd = process.argv[1];
15-
16-
// Report installer install/update/uninstall events
17-
if (cmd === '--squirrel-install') {
18-
analytics.event('Setup', 'Install').send();
19-
} else if (cmd === '--squirrel-updated') {
20-
analytics.event('Setup', 'Update').send();
21-
} else if (cmd === '--squirrel-uninstall') {
22-
analytics.event('Setup', 'Uninstall').send();
23-
}
24-
}
25-
2613
if (isFirstRun()) {
2714
analytics.event('Setup', 'First run', process.platform).send();
2815
}

0 commit comments

Comments
 (0)