Skip to content

Commit

Permalink
saving works again + packaging improvements (#1116)
Browse files Browse the repository at this point in the history
  • Loading branch information
UnchartedBull committed Oct 23, 2020
1 parent ae26107 commit 24d0cc3
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 51 deletions.
20 changes: 16 additions & 4 deletions helper/listener.js
Original file line number Diff line number Diff line change
@@ -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');
Expand All @@ -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,
}),
);
}
});
}

Expand All @@ -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);
}
Expand Down
6 changes: 3 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -55,15 +55,15 @@ 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,
}),
);
window.setFullScreen(true);
}

activateListeners(ipcMain, window, app);
activateListeners(ipcMain, window, app, dev);

window.on('closed', () => {
window = null;
Expand Down
60 changes: 16 additions & 44 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,58 +9,30 @@
"email": "[email protected]"
},
"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",
"directories": {
"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": [
Expand Down

0 comments on commit 24d0cc3

Please sign in to comment.