Permalink
Browse files

Set up initial app boilerplate (#1)

  • Loading branch information...
sindresorhus authored and lukechilds committed Jan 2, 2018
1 parent 5df5406 commit aa9bcb0904990ce6811bb3a14533865c03be5ddc
View
@@ -0,0 +1,12 @@
root = true
[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.yml]
indent_style = space
indent_size = 2
View
@@ -0,0 +1,2 @@
* text=auto
*.js text eol=lf
View
@@ -0,0 +1,3 @@
node_modules
/app/renderer-dist
/dist
View
@@ -0,0 +1,7 @@
os: osx
osx_image: xcode9.2
language: node_js
node_js: '8'
script:
- npm test
- npm run dist
View
@@ -0,0 +1,53 @@
# HyperDEX <img src="app/static/icon.png" width="40">
> [BarterDEX](https://barterdex.supernet.org) desktop app
## Install
*macOS 10.9+, Linux, and Windows 7+ are supported (64-bit only).*
### macOS
[**Download**](https://github.com/lukechilds/hyperdex/releases/latest) the `.dmg` file.
### Linux
[**Download**](https://github.com/lukechilds/hyperdex/releases/latest) the `.AppImage` (recommended), `.deb`, or `rpm` file.
*The AppImage needs to be [made executable](http://discourse.appimage.org/t/how-to-make-an-appimage-executable/80) after download.*
### Windows
[**Download**](https://github.com/lukechilds/hyperdex/releases/latest) the `.exe` file.
---
## Dev
### Run
```
$ yarn && yarn run start
```
### Build
```
$ yarn run pack
```
### Release
```
$ yarn run release
```
Then edit the automatically created GitHub Releases draft and publish.
## License
MIT
View
@@ -0,0 +1,12 @@
'use strict';
const Store = require('electron-store');
module.exports = new Store({
defaults: {
windowState: {
width: 800,
height: 600
},
darkMode: false
}
});
View
@@ -0,0 +1,82 @@
'use strict';
const electron = require('electron');
const log = require('electron-log');
const {autoUpdater} = require('electron-updater');
const {is} = require('electron-util');
const appMenu = require('./menu');
const config = require('./config');
require('electron-debug')({enabled: true});
require('electron-context-menu')();
const {app} = electron;
app.setAppUserModelId('com.lukechilds.hyperdex');
if (!is.development) {
autoUpdater.logger = log;
autoUpdater.logger.transports.file.level = 'info';
autoUpdater.checkForUpdates();
}
let mainWindow;
const isAlreadyRunning = app.makeSingleInstance(() => {
if (mainWindow) {
if (mainWindow.isMinimized()) {
mainWindow.restore();
}
mainWindow.show();
}
});
if (isAlreadyRunning) {
app.quit();
}
function createMainWindow() {
const windowState = config.get('windowState');
const isDarkMode = config.get('darkMode');
const win = new electron.BrowserWindow({
show: false,
title: app.getName(),
x: windowState.x,
y: windowState.y,
width: windowState.width,
height: windowState.height,
minWidth: 400,
minHeight: 200,
darkTheme: isDarkMode // GTK+3
});
win.loadURL(`file://${__dirname}/renderer-dist/index.html`);
win.on('ready-to-show', () => {
win.show();
});
return win;
}
app.on('ready', () => {
electron.Menu.setApplicationMenu(appMenu);
mainWindow = createMainWindow();
});
app.on('activate', () => {
if (!mainWindow) {
mainWindow = createMainWindow();
}
});
app.on('window-all-closed', () => {
app.quit();
});
app.on('before-quit', () => {
if (!mainWindow.isFullScreen()) {
config.set('windowState', mainWindow.getBounds());
}
});
Oops, something went wrong.

0 comments on commit aa9bcb0

Please sign in to comment.