let app = require('app');  // Module to control application life.
let BrowserWindow = require('browser-window');  // Module to create native browser window.
let events = require('events');
let path = require('path');

let config = require('./config');

// Report crashes to our server.
require('crash-reporter').start();

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is GCed.
let mainWindow = null;
let menuWindow = null;

// 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();
  }
});

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
app.on('ready', function() {
  // Create the browser window.
  mainWindow = new BrowserWindow({width: 1100, height: 600});

  // let Menu = require('./remote/Menu');
  // let m = Menu.newMenu();
  // mainWindow.setMenu(m);

  // and load the index.html of the app.
  mainWindow.loadUrl('file://' + path.resolve(path.join(__dirname, '..', '/web/index.html')));

  // Open the devtools.
  if (config.__DEV__) {
    mainWindow.openDevTools();
  }

  // Setup the menu bar
  let Menu = require('./remote/Menu');
  Menu.setupMenu();

  // 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;

    // per @ide's request, we will quit the app here.
    process.exit();
  });
});

@@ -1,72 +1,49 @@
-let app = require('app');  // Module to control application life.%0Ale
+import AutoUpdater from 'auto-updater';%0Aimpor
 t Br
@@ -54,26 +54,21 @@
 rWindow 
-= require(
+from 
 'browser
@@ -79,137 +79,210 @@
 dow'
-);  // Module to create native browser window.%0Alet events = require('event
+;%0Aimport CrashReporter from 'crash-reporter';%0A%0Aimport app from 'app';%0Aimport os from 'o
 s'
-)
 ;%0A
-le
+impor
 t path 
-= require('path');%0A%0Alet config = require(
+from 'path';%0Aimport process from 'process';%0A%0Aimport Menu from './remote/Menu';%0A%0Aimport config from 
 './c
@@ -287,17 +287,16 @@
 /config'
-)
 ;%0A%0A// Re
@@ -327,33 +327,21 @@
 er.%0A
-require('c
+C
 rash
--r
+R
 eporter
-')
 .sta
@@ -516,277 +516,45 @@
 ll;%0A
-let menuWindow = null;%0A%0A// Quit when all windows are closed.%0Aapp.on('window-all-closed', function() %7B%0A  // On OS X it is common for applications and their menu bar%0A  // to stay active until the user quits explicitly with Cmd + Q%0A  if (process.platform != 'darwin')
+%0Aapp.on('window-all-closed', () =%3E
  %7B%0A
-  
   ap
@@ -567,132 +567,13 @@
 ();%0A
-  %7D%0A
 %7D);%0A%0A
-// This method will be called when Electron has finished%0A// initialization and is ready to create browser windows.%0A
 app.
@@ -584,26 +584,21 @@
 ready', 
-function()
+() =%3E
  %7B%0A  // 
@@ -689,150 +689,8 @@
 0%7D);
-%0A%0A  // let Menu = require('./remote/Menu');%0A  // let m = Menu.newMenu();%0A  // mainWindow.setMenu(m);%0A%0A  // and load the index.html of the app.
 %0A  m
@@ -711,20 +711,18 @@
 Url(
-'
+%60
 file://
-' + 
+$%7B
 path
@@ -734,18 +734,8 @@
 lve(
-path.join(
 __di
@@ -748,12 +748,8 @@
  '..
-', '
 /web
@@ -761,17 +761,18 @@
 x.html')
-)
+%7D%60
 );%0A%0A  //
@@ -881,105 +881,136 @@
 r%0A  
-let Menu = require('./remote/Menu');%0A  Menu.setupMenu();%0A%0A  // Emitted when the window is closed.
+Menu.setupMenu();%0A%0A  // Register for automatic updates%0A  if (process.platform === 'darwin') %7B%0A    registerForAutoUpdates();%0A  %7D%0A
 %0A  m
@@ -1036,18 +1036,13 @@
 d', 
-function()
+() =%3E
  %7B%0A 
@@ -1266,89 +1266,238 @@
 ll;%0A
-%0A
   
-  // per @ide's request, we will quit the app here.%0A    process.exit();
+%7D);%0A%7D);%0A%0Afunction registerForAutoUpdates() %7B%0A  let platform = %60$%7Bos.platform()%7D_$%7Bos.arch()%7D%60;%0A  let version = app.getVersion();%0A  AutoUpdater.setFeedUrl(%0A    %60http://xde-updates.exponentjs.com/update/$%7Bplatform%7D/$%7Bversion%7D%60
 %0A  
-%7D
 );%0A%7D
-);
 %0A

Call into AutoUpdater and point it at our Nuts server