Skip to content
This repository was archived by the owner on Sep 2, 2023. It is now read-only.

Commit ac9cbc7

Browse files
committed
Update electron builder
1 parent 5d37384 commit ac9cbc7

File tree

5 files changed

+35
-17
lines changed

5 files changed

+35
-17
lines changed

build/background.png

33.1 KB
Loading

build/icon.icns

201 KB
Binary file not shown.

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
"build:apk": "npm run build:dev && cordova build --release android && jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore tick-trade-key.keystore ./platforms/android/build/outputs/apk/android-release-unsigned.apk TickTrade && ~/Library/Android/sdk/build-tools/24.0.0/zipalign -v 4 ./platforms/android/build/outputs/apk/android-release-unsigned.apk ./platforms/android/build/outputs/apk/android-release-aligned.apk",
2222
"build:webpack": "NODE_ENV=production webpack --config webpack.config.js",
2323
"lint": "eslint src",
24-
"electron": "electron ./www",
24+
"electron": "NODE_ENV=developement electron ./www",
2525
"translate": "bash fetch-translation.sh",
26-
"dist": "build -owl --ia32 --x64",
26+
"dist": "NODE_ENV=developement build -owl --ia32 --x64",
2727
"prerelease:osx": "rm -rf ./release/osx && mkdirp release/osx",
2828
"release:osx": "cp -rv ./dist/osx/*.{dmg,zip} ./release/osx && PACKAGE_VERSION=$(cat app/package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && echo $PACKAGE_VERSION >> ./release/osx/VERSION",
2929
"prerelease:win32": "rm -rf ./release/win32 && mkdirp release/win32",
@@ -38,9 +38,9 @@
3838
"build": {
3939
"appId": "app.binary.com",
4040
"app-category-type": "public.app-category.trading",
41-
"productName": "binary trading app",
41+
"productName": "Binary.com",
4242
"osx": {
43-
"title": "binary App",
43+
"title": "Binary.com",
4444
"background": "build/background.png",
4545
"icon": "build/icon.icns",
4646
"icon-size": 128,
@@ -158,6 +158,8 @@
158158
"chai-subset": "^1.3.0",
159159
"coveralls": "^2.11.12",
160160
"css-loader": "^0.24.0",
161+
"electron": "^1.3.5",
162+
"electron-builder": "^6.4.0",
161163
"enzyme": "^2.4.1",
162164
"eslint": "^3.4.0",
163165
"eslint-config-airbnb": "^10.0.1",

www/main.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ const name = app.getName();
1313
var updateFeed = 'http://localhost:3000/updates/latest';
1414
var isDevelopment = process.env.NODE_ENV === 'development';
1515
var feedURL = '';
16+
const logger = require('winston');
17+
logger.level = 'debug';
18+
global.logger = logger;
19+
const path = require('path');
1620

1721
// Don't use auto-updater if we are in development
1822
if (!isDevelopment) {
@@ -23,31 +27,31 @@ if (!isDevelopment) {
2327
}
2428

2529
autoUpdater.addListener('update-available', function(event) {
26-
console.log('A new update is available');
30+
logger.log('A new update is available');
2731
if (mainWindow) {
2832
mainWindow.webContents.send('update-message', 'update-available');
2933
}
3034
});
31-
autoUpdater.addListener("update-downloaded", function(event, releaseNotes, releaseName, releaseDate, updateURL) {
32-
console.log('A new update is ready to install', `Version ${releaseName} is downloaded and will be automatically installed on Quit`)
35+
autoUpdater.addListener('update-downloaded', function (event, releaseNotes, releaseName, releaseDate, updateURL) {
36+
logger.log('A new update is ready to install', `Version ${releaseName} is downloaded and will be automatically installed on Quit`)
3337
if (mainWindow) {
3438
mainWindow.webContents.send('update-message', 'update-downloaded');
3539
}
3640
});
3741
autoUpdater.addListener('error', function (error) {
38-
console.log(error);
42+
logger.log(error);
3943
if (mainWindow) {
4044
mainWindow.webContents.send('update-message', 'update-error');
4145
}
4246
});
4347
autoUpdater.addListener('checking-for-update', function (event) {
44-
console.log('checking-for-update');
48+
logger.log('checking-for-update');
4549
if (mainWindow) {
4650
mainWindow.webContents.send('update-message', 'checking-for-update');
4751
}
4852
});
4953
autoUpdater.addListener("update-not-available", function () {
50-
console.log('update-not-available');
54+
logger.log('update-not-available');
5155
if (mainWindow) {
5256
mainWindow.webContents.send('update-message', 'update-not-available');
5357
}
@@ -181,37 +185,45 @@ app.on('ready', function() {
181185

182186
const menu = Menu.buildFromTemplate(template);
183187

188+
logger.debug('Starting application');
189+
184190
Menu.setApplicationMenu(menu);
185191
mainWindow = new BrowserWindow({
192+
name: 'Binary.com',
186193
width: 1024,
187194
height: 680,
195+
toolbar: false,
188196
});
189197

190-
mainWindow.loadURL('file://' + __dirname + '/index.html');
198+
mainWindow.loadURL(path.join('file://', __dirname, '/index.html'));
191199

192200
mainWindow.on('closed', function () {
193201
console.log('closed');
194202
mainWindow = null;
195203
app.quit();
196204
});
197205

206+
// Uncomment to use Chrome developer tools
207+
mainWindow.webContents.openDevTools({detach:true});
208+
198209
mainWindow.on('close', function (e) {
199210
if (!forceQuit) {
200211
e.preventDefault();
201212
mainWindow.hide();
213+
} else {
214+
app.quit();
202215
}
203216
});
204217
app.on('activate', function () {
205218
mainWindow.show();
206219
});
207220

208221
mainWindow.on('show', function (e) {
209-
console.log('the window is showing');
210222
mainWindow.show();
211223
});
212224

213225
mainWindow.on('hide', function (e) {
214-
console.log('the main window is hiding');
226+
mainWindow.hide();
215227
});
216228
});
217229

www/package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
{
2-
"name": "binaryapp",
3-
"productName": "binary trading app",
2+
"name": "binary-next-gen",
3+
"productName": "Binary.com",
44
"version": "0.0.1",
55
"description": "Sharp Prices. Smart Trading",
66
"author": "binary.com <[email protected]>",
77
"homepage": "app.binary.com",
88
"moduleType": [],
99
"private": true,
10-
"files": ["**\/*", "!ignoreMe${www/node_modules/*}"],
10+
"files": [
11+
"**/*",
12+
"!ignoreMe${www/node_modules/*}"
13+
],
1114
"main": "main.js",
1215
"license": "MIT",
1316
"dependencies": {
14-
"electron-squirrel-startup": "^1.0.0"
17+
"electron-squirrel-startup": "^1.0.0",
18+
"winston": "^2.2.0"
1519
}
1620
}

0 commit comments

Comments
 (0)