No more commonjs for the main process

This commit is contained in:
Timothy Warren 2018-04-20 11:17:44 -04:00
parent 83e53cf84e
commit ceb28c34ca
7 changed files with 49 additions and 17 deletions

View File

@ -7,12 +7,15 @@
"dotenv": "5.0.1", "dotenv": "5.0.1",
"dotenv-expand": "4.2.0", "dotenv-expand": "4.2.0",
"electron-log": "^2.2.14", "electron-log": "^2.2.14",
"esm": "^3.0.20",
"exiftool-vendored": "^4.20.0", "exiftool-vendored": "^4.20.0",
"inferno": "^5.0.1", "inferno": "^5.0.1",
"inferno-bootstrap": "^5.0.0", "inferno-bootstrap": "^5.0.0",
"inferno-dev-utils": "^5.3.0", "inferno-dev-utils": "^5.3.0",
"inferno-redux": "^5.0.4",
"inferno-router": "^5.0.1", "inferno-router": "^5.0.1",
"lodash": "^4.17.5", "lodash": "^4.17.5",
"redux": "^4.0.0",
"ws": "^5.1.1" "ws": "^5.1.1"
}, },
"devDependencies": { "devDependencies": {
@ -75,7 +78,7 @@
"test": "node scripts/test.js --env=jsdom" "test": "node scripts/test.js --env=jsdom"
}, },
"homepage": "./", "homepage": "./",
"main": "src/electron/starter.js", "main": "src/electron/index.js",
"jest": { "jest": {
"collectCoverageFrom": [ "collectCoverageFrom": [
"src/**/*.{js,jsx,mjs}" "src/**/*.{js,jsx,mjs}"

View File

@ -1,7 +1,7 @@
const {app, BrowserWindow} = require('electron'); import {app, BrowserWindow} from 'electron';
const log = require('electron-log'); import log from 'electron-log';
const path = require('path'); import path from 'path';
const url = require('url'); import url from 'url';
log.transports.file.level = false; log.transports.file.level = false;
log.transports.console.level = 'info'; log.transports.console.level = 'info';

View File

@ -1,4 +1,4 @@
const {ExifTool} = require('exiftool-vendored'); import {ExifTool} from 'exiftool-vendored';
const exiftool = new ExifTool(); const exiftool = new ExifTool();
/** /**
@ -11,6 +11,6 @@ function getExifTags (imgPath) {
return exiftool.read(imgPath); return exiftool.read(imgPath);
} }
module.exports = { export {
getExifTags, getExifTags,
}; };

3
src/electron/index.js Normal file
View File

@ -0,0 +1,3 @@
// eslint-disable-next-line
require = require('esm')(module/*, options */);
module.exports = require('./starter.js');

View File

@ -1,8 +1,8 @@
// eslint-disable-next-line
global.eval = () => {};
// Do app initialization and event handling // Do app initialization and event handling
require('./app'); import './app';
// Initialize websockets // Initialize websockets
require('./websocket-events'); import './websocket-events';
// eslint-disable-next-line
global.eval = () => {};

View File

@ -1,12 +1,12 @@
/** /**
* Websocket event handlers * Websocket event handlers
*/ */
const {dialog, BrowserWindow} = require('electron'); import {dialog, BrowserWindow} from 'electron';
// eslint-disable-next-line // eslint-disable-next-line
const WebSocket = require('ws'); import WebSocket from 'ws';
const {getExifTags} = require('./exif-helpers'); import {getExifTags} from './exif-helpers';
const {JSONMessage} = require('../helpers/web-socket'); import {JSONMessage} from '../helpers/web-socket';
const wss = new WebSocket.Server({ const wss = new WebSocket.Server({
perMessageDeflate: false, perMessageDeflate: false,

View File

@ -3041,6 +3041,10 @@ eslint@^4.19.0, eslint@^4.19.1:
table "4.0.2" table "4.0.2"
text-table "~0.2.0" text-table "~0.2.0"
esm@^3.0.20:
version "3.0.20"
resolved "https://registry.npmjs.org/esm/-/esm-3.0.20.tgz#6659d3c3ed0342354e7f1eaf6204a01083781426"
espree@^3.5.4: espree@^3.5.4:
version "3.5.4" version "3.5.4"
resolved "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7" resolved "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7"
@ -4216,6 +4220,13 @@ inferno-popper@^5.0.0:
is-equal-shallow "^0.1.3" is-equal-shallow "^0.1.3"
popper.js "^1.10.8" popper.js "^1.10.8"
inferno-redux@^5.0.4:
version "5.0.4"
resolved "https://registry.npmjs.org/inferno-redux/-/inferno-redux-5.0.4.tgz#9fa821478bce101a3316b60c452809c1dbdb96cc"
dependencies:
hoist-non-inferno-statics "^1.1.3"
inferno-shared "5.0.4"
inferno-router@^5.0.1: inferno-router@^5.0.1:
version "5.0.3" version "5.0.3"
resolved "https://registry.npmjs.org/inferno-router/-/inferno-router-5.0.3.tgz#3ac47e22e4cbec08129d13cc83200b9128b930d8" resolved "https://registry.npmjs.org/inferno-router/-/inferno-router-5.0.3.tgz#3ac47e22e4cbec08129d13cc83200b9128b930d8"
@ -4231,6 +4242,10 @@ inferno-shared@5.0.3, inferno-shared@^5.0.1:
version "5.0.3" version "5.0.3"
resolved "https://registry.npmjs.org/inferno-shared/-/inferno-shared-5.0.3.tgz#dc9d437e1fb783c7669135d81027d5cc972a5d9b" resolved "https://registry.npmjs.org/inferno-shared/-/inferno-shared-5.0.3.tgz#dc9d437e1fb783c7669135d81027d5cc972a5d9b"
inferno-shared@5.0.4:
version "5.0.4"
resolved "https://registry.npmjs.org/inferno-shared/-/inferno-shared-5.0.4.tgz#a8167271096b4a5be8c327ee4861a3eb010ed6bd"
inferno-vnode-flags@5.0.3, inferno-vnode-flags@^5.0.1: inferno-vnode-flags@5.0.3, inferno-vnode-flags@^5.0.1:
version "5.0.3" version "5.0.3"
resolved "https://registry.npmjs.org/inferno-vnode-flags/-/inferno-vnode-flags-5.0.3.tgz#87145797e54b32bb4e18461de1cb0eb34117a765" resolved "https://registry.npmjs.org/inferno-vnode-flags/-/inferno-vnode-flags-5.0.3.tgz#87145797e54b32bb4e18461de1cb0eb34117a765"
@ -5322,7 +5337,7 @@ longest@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" resolved "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"
loose-envify@^1.0.0, loose-envify@^1.2.0, loose-envify@^1.3.1: loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1:
version "1.3.1" version "1.3.1"
resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
dependencies: dependencies:
@ -6855,6 +6870,13 @@ reduce-function-call@^1.0.1:
dependencies: dependencies:
balanced-match "^0.4.2" balanced-match "^0.4.2"
redux@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/redux/-/redux-4.0.0.tgz#aa698a92b729315d22b34a0553d7e6533555cc03"
dependencies:
loose-envify "^1.1.0"
symbol-observable "^1.2.0"
regenerate@^1.2.1: regenerate@^1.2.1:
version "1.3.3" version "1.3.3"
resolved "https://registry.npmjs.org/regenerate/-/regenerate-1.3.3.tgz#0c336d3980553d755c39b586ae3b20aa49c82b7f" resolved "https://registry.npmjs.org/regenerate/-/regenerate-1.3.3.tgz#0c336d3980553d755c39b586ae3b20aa49c82b7f"
@ -7780,6 +7802,10 @@ symbol-observable@1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4" resolved "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4"
symbol-observable@^1.2.0:
version "1.2.0"
resolved "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804"
symbol-tree@^3.2.2: symbol-tree@^3.2.2:
version "3.2.2" version "3.2.2"
resolved "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" resolved "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6"