diff --git a/helper/listener.js b/helper/listener.js index 185ddf139..ddb7c55e8 100644 --- a/helper/listener.js +++ b/helper/listener.js @@ -1,6 +1,8 @@ /* eslint-disable @typescript-eslint/no-var-requires */ /* eslint-disable import/no-commonjs */ const exec = require('child_process').exec; +const url = require('url'); +const path = require('path'); const sendCustomStyles = require('./styles'); const { downloadUpdate, sendVersionInfo } = require('./update'); @@ -18,9 +20,19 @@ function activateScreenSleepListener(ipcMain) { }); } -function activateReloadListener(ipcMain, window) { +function activateReloadListener(ipcMain, window, dev) { ipcMain.on('reload', () => { - window.reload(); + if (dev) { + window.reload(); + } else { + window.loadURL( + url.format({ + pathname: path.join(__dirname, '..', 'dist', 'index.html'), + protocol: 'file:', + slashes: true, + }), + ); + } }); } @@ -47,10 +59,10 @@ function activateDiscoverListener(ipcMain, window) { }); } -function activateListeners(ipcMain, window, app) { +function activateListeners(ipcMain, window, app, dev) { activateAppInfoListener(ipcMain, window, app); activateScreenSleepListener(ipcMain); - activateReloadListener(ipcMain, window); + activateReloadListener(ipcMain, window, dev); activateUpdateListener(ipcMain, window); activateDiscoverListener(ipcMain, window); } diff --git a/main.js b/main.js index f12878ac7..c63a8c2ee 100644 --- a/main.js +++ b/main.js @@ -46,7 +46,7 @@ function createWindow() { // TODO: enable + contextBridge (probably electron-ngx before release 12) contextIsolation: false, }, - icon: path.join(__dirname, 'src', 'assets', 'icon', 'icon.png'), + icon: path.join(__dirname, 'dist', 'assets', 'icon', 'icon.png'), }); if (dev) { @@ -55,7 +55,7 @@ function createWindow() { } else { window.loadURL( url.format({ - pathname: path.join(__dirname, 'dist/index.html'), + pathname: path.join(__dirname, 'dist', 'index.html'), protocol: 'file:', slashes: true, }), @@ -63,7 +63,7 @@ function createWindow() { window.setFullScreen(true); } - activateListeners(ipcMain, window, app); + activateListeners(ipcMain, window, app, dev); window.on('closed', () => { window = null; diff --git a/package.json b/package.json index b628d6b7a..054fd0ba9 100644 --- a/package.json +++ b/package.json @@ -9,22 +9,6 @@ "email": "timon.gaebelein@icloud.com" }, "main": "main.js", - "files": [ - "main.js", - "node_modules", - "dist", - "!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme}", - "!**/node_modules/*/{test,__tests__,tests,powered-test,example,examples}", - "!**/node_modules/*.d.ts", - "!**/node_modules/.bin", - "!**/*.{iml,o,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,xproj}", - "!.editorconfig", - "!**/._*", - "!**/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,.gitignore,.gitattributes}", - "!**/{__pycache__,thumbs.db,.flowconfig,.idea,.vs,.nyc_output}", - "!**/{appveyor.yml,.travis.yml,circle.yml}", - "!**/{npm-debug.log,yarn.lock,.yarn-integrity,.yarn-metadata.json}" - ], "build": { "appId": "octodash", "productName": "OctoDash", @@ -32,35 +16,23 @@ "output": "package" }, "files": [ - "**/*", + "main.js", + "helper", + "dist", + "node_modules", + "themes/**/*.css", "LICENSE.md", - "!**/*.ts", - "!*.code-workspace", - "!package.json", - "!package-lock.json", - "!CONTRIBUTING.md", - "!README.md", - "!sample.config.json", - "!angular.json", - "!karma.conf.js", - "!tsconfig.app.json", - "!tsconfig.json", - "!tsconfig.spec.json", - "!.eslintrc.js", - "!.gitignore", - "!.prettierrc", - "!.travis.yml", - "!.dependabot/", - "!.github/", - "!.vscode/", - "!src/", - "!e2e/", - "!docs/", - "!package/", - "!screenshots/", - "!scripts/", - "!themes/", - "!build/" + "!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme}", + "!**/node_modules/*/{test,__tests__,tests,powered-test,example,examples}", + "!**/node_modules/*.d.ts", + "!**/node_modules/.bin", + "!**/*.{iml,o,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,xproj}", + "!.editorconfig", + "!**/._*", + "!**/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,.gitignore,.gitattributes}", + "!**/{__pycache__,thumbs.db,.flowconfig,.idea,.vs,.nyc_output}", + "!**/{appveyor.yml,.travis.yml,circle.yml}", + "!**/{npm-debug.log,yarn.lock,.yarn-integrity,.yarn-metadata.json}" ], "linux": { "target": [