Babelify the main.jsO

This commit is contained in:
Gregory Schier 2016-11-09 18:53:06 -08:00
parent 2ebc64b271
commit 37359a905b
3 changed files with 20 additions and 29 deletions

View File

@ -1,45 +1,35 @@
'use strict';
if (require('electron-squirrel-startup')) { if (require('electron-squirrel-startup')) {
process.exit(0); process.exit(0);
} }
import raven from 'raven';
import request from 'request';
import path from 'path';
import * as packageJSON from './package.json';
import electron from 'electron';
import mkdirp from 'mkdirp';
import fs from 'fs';
// Some useful helpers // Some useful helpers
const IS_DEV = process.env.INSOMNIA_ENV === 'development'; const IS_DEV = process.env.INSOMNIA_ENV === 'development';
const IS_MAC = process.platform === 'darwin'; const IS_MAC = process.platform === 'darwin';
const IS_WINDOWS = process.platform === 'win32'; const IS_WINDOWS = process.platform === 'win32';
const IS_LINUX = !IS_MAC && !IS_WINDOWS; const IS_LINUX = !IS_MAC && !IS_WINDOWS;
var raven = require('raven'); var ravenClient = new raven.Client('https://786e43ae199c4757a9ea4a48a9abd17d@sentry.io/109702', {
var ravenClient = new raven.Client(
'https://786e43ae199c4757a9ea4a48a9abd17d@sentry.io/109702', {
environment: process.env.INSOMNIA_ENV || 'production', environment: process.env.INSOMNIA_ENV || 'production',
release: require('./package.json').version, release: require('./package.json').version,
logger: 'electron.main' logger: 'electron.main'
}); });
if (!IS_DEV) { if (!IS_DEV) {
ravenClient.patchGlobal(); ravenClient.patchGlobal();
} }
// Don't npm install this (it breaks). Rely on the global one. // Don't npm install this (it breaks). Rely on the global one.
const request = require('request');
const path = require('path');
const {version: appVersion, productName: appName} = require('./package.json');
const electron = require('electron');
const mkdirp = require('mkdirp');
const fs = require('fs');
const {
app,
dialog,
shell,
ipcMain,
autoUpdater,
Menu,
BrowserWindow,
webContents
} = require('electron');
const {app, dialog, shell, ipcMain, autoUpdater, Menu, BrowserWindow, webContents} = electron;
const {version: appVersion, productName: appName} = packageJSON;
const LOCAL_STORAGE_DIR = path.join(app.getPath('userData'), 'localStorage'); const LOCAL_STORAGE_DIR = path.join(app.getPath('userData'), 'localStorage');
const UPDATE_URLS = { const UPDATE_URLS = {

View File

@ -11,10 +11,11 @@
"url": "https://github.com/gschier/insomnia" "url": "https://github.com/gschier/insomnia"
}, },
"scripts": { "scripts": {
"test:noisy": "jest",
"test:watch": "jest --watch",
"test": "jest --silent", "test": "jest --silent",
"test-noisy": "jest",
"test-watch": "jest --watch", "start-hot": "cross-env HOT=1 INSOMNIA_ENV=development electron -r babel-register ./app/main.development.js",
"start-hot": "cross-env HOT=1 INSOMNIA_ENV=development ./node_modules/electron/cli.js ./app/main.js",
"hot-server": "babel-node ./webpack/server.js", "hot-server": "babel-node ./webpack/server.js",
"dev": "concurrently --kill-others \"npm run hot-server\" \"npm run start-hot\"", "dev": "concurrently --kill-others \"npm run hot-server\" \"npm run start-hot\"",
"build:clean": "rm -rf ./build && rm -rf ./dist && mkdir ./build", "build:clean": "rm -rf ./build && rm -rf ./dist && mkdir ./build",

View File

@ -4,7 +4,7 @@ import productionConfig from './webpack.config.production.babel';
export default { export default {
...productionConfig, ...productionConfig,
entry: [ entry: [
'./main.js' './main.development.js'
], ],
output: { output: {
path: path.join(__dirname, '../build'), path: path.join(__dirname, '../build'),