diff --git a/package.json b/package.json index fb01faa..a4a0bf8 100644 --- a/package.json +++ b/package.json @@ -53,18 +53,18 @@ "not ie <= 11", "not op_mini all" ], - "main": "electron.js", + "main": "public/electron.js", "homepage": "./", "build": { "appId": "repertory-ui", "artifactName": "${productName}_${version}_${os}_${arch}.${ext}", "files": [ "./electron.js", - "./src/constants.js", + "src/constants.js", "build/**/*", "node_modules/**/*", - "./helpers.js", - "./public/detect_linux.sh" + "src/helpers.js", + "public/detect_linux.sh" ], "linux": { "category": "Utility", diff --git a/electron.js b/public/electron.js similarity index 98% rename from electron.js rename to public/electron.js index be4bd04..43d0701 100644 --- a/electron.js +++ b/public/electron.js @@ -2,19 +2,19 @@ const {app, BrowserWindow, Tray, nativeImage, Menu, dialog} = require('electron'); const {ipcMain} = require('electron'); -const Constants = require('./src/constants'); +const Constants = require('../src/constants'); const path = require('path'); const url = require('url'); -require('electron-debug')(); +require('electron-debug/index')(); const os = require('os'); -const helpers = require('./helpers'); +const helpers = require('../src/helpers'); const fs = require('fs'); const unzip = require('unzipper'); const AutoLaunch = require('auto-launch'); require.extensions['.sh'] = function (module, filename) { module.exports = fs.readFileSync(filename, 'utf8'); }; -const detectScript = require('./public/detect_linux.sh'); +const detectScript = require('./detect_linux.sh'); // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. @@ -47,7 +47,6 @@ function setWindowVisibility(show) { if (mainWindow.isMinimized()) { mainWindow.restore(); } - mainWindow.focus(); } else { mainWindow.hide(); @@ -83,9 +82,11 @@ function createWindow() { app.dock.hide(); } + mainWindow.openDevTools(); + // and load the index.html of the app. const startUrl = process.env.ELECTRON_START_URL || url.format({ - pathname: path.join(__dirname, '/build/index.html'), + pathname: path.join(__dirname, '../build/index.html'), protocol: 'file:', slashes: true }); @@ -436,9 +437,9 @@ ipcMain.on(Constants.IPC_Detect_Mounts, (event, data) => { let image; if (driveInUse) { - image = nativeImage.createFromPath(path.join(__dirname, os.platform() === 'darwin' ? '/build/logo_both_mac.png' : '/build/logo_both.png')); + image = nativeImage.createFromPath(path.join(__dirname, os.platform() === 'darwin' ? '../build/logo_both_mac.png' : '../build/logo_both.png')); } else { - image = nativeImage.createFromPath(path.join(__dirname, os.platform() === 'darwin' ? '/build/logo_mac.png' : '/build/logo.png')); + image = nativeImage.createFromPath(path.join(__dirname, os.platform() === 'darwin' ? '../build/logo_mac.png' : '../build/logo.png')); } mainWindowTray.setImage(image); diff --git a/helpers.js b/src/helpers.js similarity index 99% rename from helpers.js rename to src/helpers.js index 945f2fa..6cf87bb 100644 --- a/helpers.js +++ b/src/helpers.js @@ -1,10 +1,10 @@ const fs = require('fs'); const path = require('path'); const os = require('os'); -const axios = require('axios'); +const axios = require('axios/index'); const exec = require('child_process').exec; const spawn = require('child_process').spawn; -const Constants = require('./src/constants'); +const Constants = require('./constants'); const tryParse = (j, def) => { try {