Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit 87797a0

Browse files
committed
Merge alpha and fix conflict
2 parents 6f6f4a9 + 862f1c0 commit 87797a0

File tree

17 files changed

+1366
-433
lines changed

17 files changed

+1366
-433
lines changed

.circleci/config.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,11 @@ workflows:
201201
test:
202202
jobs:
203203
- checkout_environment
204+
205+
# Testing
204206
- test_mobile_js:
205207
requires:
206208
- checkout_environment
207-
208209
# Disabled as Expo is fixing their critical issue with Detox
209210
# - test_mobile_native:
210211
# requires:
@@ -215,6 +216,8 @@ workflows:
215216
- test_static_js:
216217
requires:
217218
- checkout_environment
219+
220+
# Deployment
218221
- deploy_alpha:
219222
requires:
220223
- test_static_js
@@ -228,4 +231,4 @@ workflows:
228231
- test_web
229232
filters:
230233
branches:
231-
only: production
234+
only: alpha

config-overrides.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ module.exports = function override(config, env) {
8888
config.plugins.push(
8989
new webpack.optimize.CommonsChunkPlugin({
9090
names: ['bootstrap'],
91-
filename: './static/js/[name].js',
91+
filename: 'static/js/[name].js',
9292
minChunks: Infinity,
9393
})
9494
);

desktop/deployment.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Desktop App Deployment
2+
3+
We have semi-continuous deployment set up for the desktop app. Here's how it works:
4+
5+
## Automatic
6+
7+
1. We merge the latest changes from `alpha` to `production`
8+
2. This prompts a CircleCI build, which packages the desktop app for all operating systems and uploads them to GitHub as a draft release. That looks something like this:
9+
10+
![screen shot 2018-05-30 at 15 42 22](https://user-images.githubusercontent.com/7525670/40724411-4b5fe9ec-6421-11e8-8e4b-d0df96b46f72.png)
11+
12+
3. Go to that draft release, download the build for your OS and test the new version locally.
13+
14+
4. If you're happy with how it works, click the "Edit" button on the draft release and you get to this screen:
15+
16+
![screenshot-2018-5-30 withspectrum spectrum](https://user-images.githubusercontent.com/7525670/40724488-77256642-6421-11e8-9911-999ed0fa5957.png)
17+
18+
4. Fill out the title and release notes of the release (like it's already done above), then click "Publish release".
19+
20+
As soon as it's published, the app will prompt existing users to upgrade to the newest version and download and install it for them.
21+
22+
## Manual
23+
24+
You can also do a manual deploy of the desktop apps. You will need to get a GitHub token from your personal GitHub settings, then run the following command:
25+
26+
```
27+
GH_TOKEN=asdf123 yarn run release:desktop
28+
```
29+

desktop/package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
"devDependencies": {
2020
"electron": "^1.8.4",
2121
"electron-builder": "^20.8.1",
22+
"nodemon": "^1.17.5",
2223
"rimraf": "^2.6.2"
2324
},
2425
"scripts": {
25-
"dev": "electron ./src/main.js",
26+
"dev": "nodemon --exec \"electron ./src/main.js\" -w ./src",
2627
"prepackage": "rimraf release",
2728
"package": "build",
2829
"package:mac": "yarn run package --mac",
@@ -35,7 +36,13 @@
3536
"productName": "Spectrum",
3637
"appId": "chat.spectrum",
3738
"copyright": "Copyright © 2018 Space Program Inc.",
38-
"publish": "github",
39+
"publish": [
40+
{
41+
"provider": "github",
42+
"repo": "spectrum",
43+
"owner": "withspectrum"
44+
}
45+
],
3946
"releaseInfo": {
4047
"releaseName": "${name} Desktop App v${version}"
4148
},

desktop/src/autoUpdate.js

Lines changed: 3 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,7 @@
11
// @flow
22
const { app, dialog } = require('electron');
33
const { autoUpdater } = require('electron-updater');
4-
const log = require('electron-log');
54

6-
// Setup logger
7-
autoUpdater.logger = log;
8-
autoUpdater.logger.transports.file.level = 'info';
9-
10-
log.info('App starting...');
11-
12-
// Setup update event
13-
autoUpdater.on('checking-for-update', () => {
14-
log.info('Checking for update... Please wait.');
15-
});
16-
autoUpdater.on('update-available', info => {
17-
log.info('Update available.');
18-
log.info('Vesrion', info.version);
19-
log.info('Release date', info.releaseDate);
20-
});
21-
autoUpdater.on('update-not-available', info => {
22-
log.info('Update not available.');
23-
});
24-
autoUpdater.on('download-progress', progress => {
25-
log.info(`Download progress: ${Math.floor(progress.percent)}`);
26-
});
27-
autoUpdater.on('update-downloaded', info => {
28-
log.info('Update downloaded');
29-
});
30-
autoUpdater.on('error', error => {
31-
log.info('Update error', error);
32-
});
33-
34-
function updateDownloaded() {
35-
// Ask user to update the app
36-
dialog.showMessageBox(
37-
{
38-
type: 'question',
39-
message: 'A new version of ' + app.getName() + ' has been downloaded',
40-
buttons: ['Install and Relaunch', 'Later'],
41-
defaultId: 0,
42-
},
43-
response => {
44-
if (response === 1) {
45-
dialog.showMessageBox({
46-
title: 'Installing Later',
47-
message: 'Update will be installed when you exit the app',
48-
});
49-
} else {
50-
autoUpdater.quitAndInstall();
51-
}
52-
}
53-
);
54-
}
55-
56-
function checkForUpdates() {
57-
autoUpdater.on('update-downloaded', updateDownloaded);
58-
59-
// init for updates
60-
autoUpdater.checkForUpdates();
61-
}
62-
63-
module.exports = checkForUpdates;
5+
module.exports = function checkForUpdates() {
6+
return autoUpdater.checkForUpdatesAndNotify();
7+
};

desktop/src/main.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ const windowStateKeeper = require('electron-window-state');
44
const { app, BrowserWindow } = electron;
55
const isDev = require('electron-is-dev');
66

7+
const FIFTEEN_MINUTES = 900000;
8+
79
const checkForUpdates = require('./autoUpdate');
810
const buildMenu = require('./menu');
911
const CONFIG = require('./config');
@@ -18,8 +20,11 @@ const startUrl = isDev ? CONFIG.APP_DEV_URL : CONFIG.APP_REMOTE_URL;
1820

1921
function createWindow() {
2022
if (!isDev) {
21-
// trigger autoupdate check
23+
// Check for updates on startup and then every 15 minutes
2224
checkForUpdates();
25+
setInterval(() => {
26+
checkForUpdates();
27+
}, FIFTEEN_MINUTES);
2328
}
2429

2530
let mainWindowState = windowStateKeeper({

desktop/src/menu.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
// @flow
2-
const { dialog, Menu, shell } = require('electron');
2+
const { dialog, Menu, MenuItem, shell } = require('electron');
3+
const checkForUpdates = require('./autoUpdate');
34

45
const CONFIG = require('./config');
56

7+
const UpdateMenuItem = new MenuItem({
8+
label: 'Check for updates',
9+
click() {
10+
this.enabled = false;
11+
checkForUpdates().then(() => {
12+
this.enabled = true;
13+
});
14+
},
15+
});
16+
617
/**
718
* Applications menu
819
**/
@@ -24,6 +35,7 @@ const template = [
2435
shell.openExternal(CONFIG.GITHUB_URL_LICENSE);
2536
},
2637
},
38+
UpdateMenuItem,
2739
{ type: 'separator' },
2840
{ role: 'hide' },
2941
{ role: 'quit' },
@@ -90,6 +102,11 @@ const template = [
90102
accelerator: 'CmdOrCtrl+R',
91103
role: 'reload',
92104
},
105+
{
106+
label: 'Force Reload',
107+
accelerator: 'CmdOrCtrl+Shift+R',
108+
role: 'forceReload',
109+
},
93110
{
94111
label: 'Close',
95112
accelerator: 'CmdOrCtrl+W',

0 commit comments

Comments
 (0)