Skip to content

Commit

Permalink
Add desktop distributions
Browse files Browse the repository at this point in the history
  • Loading branch information
cronoh committed Feb 15, 2018
1 parent b1e568a commit 72c01cd
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,6 +2,7 @@

# compiled output
/dist
/dist-desktop
/tmp
/out-tsc

Expand Down
Binary file added build/icon.icns
Binary file not shown.
Binary file added build/icon.ico
Binary file not shown.
64 changes: 64 additions & 0 deletions main.js
@@ -0,0 +1,64 @@
const { app, BrowserWindow, shell, Menu } = require('electron');

let mainWindow;

function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({width: 1000, height: 600});
const options = { extraHeaders: "pragma: no-cache\n" };
mainWindow.loadURL('https://nanovault.io', options);
// mainWindow.loadURL('http://localhost:4200/');
// TODO: Use environment to load config which holds the actual url to load for the app

// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})

mainWindow.webContents.on('new-window', function(e, url) {
e.preventDefault();
shell.openExternal(url);
});

if (process.platform === 'darwin') {
// Create our menu entries so that we can use MAC shortcuts
Menu.setApplicationMenu(Menu.buildFromTemplate([
{
label: 'Edit',
submenu: [
{ role: 'undo' },
{ role: 'redo' },
{ type: 'separator' },
{ role: 'cut' },
{ role: 'copy' },
{ role: 'paste' },
{ role: 'pasteandmatchstyle' },
{ role: 'delete' },
{ role: 'selectall' }
]
}
]));
}
}

app.on('ready', createWindow)

// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})

app.on('activate', function () {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
});
31 changes: 28 additions & 3 deletions package.json
@@ -1,14 +1,21 @@
{
"name": "raivault",
"version": "0.0.0",
"name": "NanoVault",
"version": "1.0.0",
"license": "MIT",
"description": "Wallet for interacting with Nano",
"author": "Andrew Steele",
"main": "main.js",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
"e2e": "ng e2e",
"desktop": "electron main.js",
"pack": "electron-builder --dir",
"dist": "electron-builder",
"dist-full": "electron-builder -wml --x64"
},
"private": true,
"dependencies": {
Expand Down Expand Up @@ -43,6 +50,8 @@
"@types/node": "~6.0.60",
"@types/qrcode": "^0.8.1",
"codelyzer": "^4.0.1",
"electron": "^1.8.2",
"electron-builder": "^19.52.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
Expand All @@ -55,5 +64,21 @@
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.4.2"
},
"build": {
"appId": "com.electron.nanovault",
"buildVersion": "1.0.0",
"productName": "NanoVault",
"copyright": "Copyright © 2018 Andrew Steele",
"directories": {
"output": "dist-desktop",
"app": "./"
},
"mac": {
"category": "public.app-category.finance"
},
"linux": {
"target": "AppImage"
}
}
}
3 changes: 3 additions & 0 deletions renderer.js
@@ -0,0 +1,3 @@
// This file is required by the index.html file and will
// be executed in the renderer process for that window.
// All of the Node.js APIs are available in this process.

0 comments on commit 72c01cd

Please sign in to comment.