Skip to content

Commit 72c01cd

Browse files
committed
Add desktop distributions
1 parent b1e568a commit 72c01cd

File tree

6 files changed

+96
-3
lines changed

6 files changed

+96
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# compiled output
44
/dist
5+
/dist-desktop
56
/tmp
67
/out-tsc
78

build/icon.icns

87.5 KB
Binary file not shown.

build/icon.ico

26.3 KB
Binary file not shown.

main.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
const { app, BrowserWindow, shell, Menu } = require('electron');
2+
3+
let mainWindow;
4+
5+
function createWindow () {
6+
// Create the browser window.
7+
mainWindow = new BrowserWindow({width: 1000, height: 600});
8+
const options = { extraHeaders: "pragma: no-cache\n" };
9+
mainWindow.loadURL('https://nanovault.io', options);
10+
// mainWindow.loadURL('http://localhost:4200/');
11+
// TODO: Use environment to load config which holds the actual url to load for the app
12+
13+
// Emitted when the window is closed.
14+
mainWindow.on('closed', function () {
15+
// Dereference the window object, usually you would store windows
16+
// in an array if your app supports multi windows, this is the time
17+
// when you should delete the corresponding element.
18+
mainWindow = null
19+
})
20+
21+
mainWindow.webContents.on('new-window', function(e, url) {
22+
e.preventDefault();
23+
shell.openExternal(url);
24+
});
25+
26+
if (process.platform === 'darwin') {
27+
// Create our menu entries so that we can use MAC shortcuts
28+
Menu.setApplicationMenu(Menu.buildFromTemplate([
29+
{
30+
label: 'Edit',
31+
submenu: [
32+
{ role: 'undo' },
33+
{ role: 'redo' },
34+
{ type: 'separator' },
35+
{ role: 'cut' },
36+
{ role: 'copy' },
37+
{ role: 'paste' },
38+
{ role: 'pasteandmatchstyle' },
39+
{ role: 'delete' },
40+
{ role: 'selectall' }
41+
]
42+
}
43+
]));
44+
}
45+
}
46+
47+
app.on('ready', createWindow)
48+
49+
// Quit when all windows are closed.
50+
app.on('window-all-closed', function () {
51+
// On OS X it is common for applications and their menu bar
52+
// to stay active until the user quits explicitly with Cmd + Q
53+
if (process.platform !== 'darwin') {
54+
app.quit()
55+
}
56+
})
57+
58+
app.on('activate', function () {
59+
// On OS X it's common to re-create a window in the app when the
60+
// dock icon is clicked and there are no other windows open.
61+
if (mainWindow === null) {
62+
createWindow()
63+
}
64+
});

package.json

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
{
2-
"name": "raivault",
3-
"version": "0.0.0",
2+
"name": "NanoVault",
3+
"version": "1.0.0",
44
"license": "MIT",
5+
"description": "Wallet for interacting with Nano",
6+
"author": "Andrew Steele",
7+
"main": "main.js",
58
"scripts": {
69
"ng": "ng",
710
"start": "ng serve",
811
"build": "ng build",
912
"test": "ng test",
1013
"lint": "ng lint",
11-
"e2e": "ng e2e"
14+
"e2e": "ng e2e",
15+
"desktop": "electron main.js",
16+
"pack": "electron-builder --dir",
17+
"dist": "electron-builder",
18+
"dist-full": "electron-builder -wml --x64"
1219
},
1320
"private": true,
1421
"dependencies": {
@@ -43,6 +50,8 @@
4350
"@types/node": "~6.0.60",
4451
"@types/qrcode": "^0.8.1",
4552
"codelyzer": "^4.0.1",
53+
"electron": "^1.8.2",
54+
"electron-builder": "^19.52.1",
4655
"jasmine-core": "~2.6.2",
4756
"jasmine-spec-reporter": "~4.1.0",
4857
"karma": "~1.7.0",
@@ -55,5 +64,21 @@
5564
"ts-node": "~3.2.0",
5665
"tslint": "~5.7.0",
5766
"typescript": "~2.4.2"
67+
},
68+
"build": {
69+
"appId": "com.electron.nanovault",
70+
"buildVersion": "1.0.0",
71+
"productName": "NanoVault",
72+
"copyright": "Copyright © 2018 Andrew Steele",
73+
"directories": {
74+
"output": "dist-desktop",
75+
"app": "./"
76+
},
77+
"mac": {
78+
"category": "public.app-category.finance"
79+
},
80+
"linux": {
81+
"target": "AppImage"
82+
}
5883
}
5984
}

renderer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// This file is required by the index.html file and will
2+
// be executed in the renderer process for that window.
3+
// All of the Node.js APIs are available in this process.

0 commit comments

Comments
 (0)