Skip to content

Commit

Permalink
fix(electron-builder): icon release not working
Browse files Browse the repository at this point in the history
  • Loading branch information
JhonatanMedeiros committed Jun 15, 2020
1 parent dbe678b commit 325c986
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 45 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img width="30%" src="./resources/icon.png" alt="WebView Angular Electron"/>
<img width="30%" src="./src/assets/icons/icon.png" alt="WebView Angular Electron"/>
</p>

<p align="center">
Expand Down
51 changes: 51 additions & 0 deletions electron-builder.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"appId": "com.jhonatanmedeiros.webview-angular-electron",
"productName": "Webview Angular Electron",
"artifactName": "WebviewAngularElectron-${version}-${os}-${arch}.${ext}",
"copyright": "Copyright © 2020 ${author}",
"directories": {
"output": "release/"
},
"files": [
"**/*",
"!**/*.ts",
"!*.code-workspace",
"!LICENSE.md",
"!package.json",
"!package-lock.json",
"!src/",
"!e2e/",
"!hooks/",
"!angular.json",
"!_config.yml",
"!karma.conf.js",
"!tsconfig.json",
"!tslint.json"
],
"win": {
"icon": "dist/webview-angular-electron/assets/icons",
"target": [
"nsis",
"msi"
]
},
"mac": {
"icon": "dist/webview-angular-electron/assets/icons",
"target": [
"dmg"
]
},
"linux": {
"icon": "dist/webview-angular-electron/assets/icons",
"category": "Development",
"packageCategory": "Development",
"target": [
"deb",
"snap",
"AppImage"
],
"desktop": {
"Encoding": "UTF-8"
}
}
}
7 changes: 4 additions & 3 deletions main-process/main-window/main-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@ export class MainWindow {

const size = electronScreen.getPrimaryDisplay().workAreaSize;

const icon = path.join(__dirname, '..', '..', 'resources', 'icon.png');

// Create the browser window.
this.browserWindow = new BrowserWindow({
x: 0,
y: 0,
width: size.width,
height: size.height,
title: app.getName(),
icon,
alwaysOnTop: false,
webPreferences: {
nodeIntegration: true,
Expand Down Expand Up @@ -65,9 +62,13 @@ export class MainWindow {
require('electron-reload')(__dirname + '../../', {
electron: require(`${__dirname}/../../node_modules/electron`)
});
const icon = path.join(__dirname, '..', '..', 'src', 'assets', 'icons', 'icon.png');
this.browserWindow.setIcon(icon);
this.browserWindow.loadURL(`http://localhost:${this.port || 4200}`);

} else {
const icon = path.join(__dirname, '..', '..', 'dist', 'webview-angular-electron', 'assets', 'icons', 'icon.png');
this.browserWindow.setIcon(icon);
this.browserWindow.loadURL(url.format({
pathname: path.join(__dirname, '..', '..', 'dist', 'webview-angular-electron', 'index.html'),
protocol: 'file:',
Expand Down
41 changes: 0 additions & 41 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"electron:serve-tsc": "tsc -p tsconfig-serve.json",
"electron:serve": "wait-on http-get://localhost:4200/ && npm run electron:serve-tsc && electron . --serve",
"electron:local": "npm run build:prod && electron .",
"package": "npm run build:prod && electron-builder build --publish never",
"electron:linux": "npm run build:prod && electron-builder build --linux",
"electron:windows": "npm run build:prod && electron-builder build --win --x64",
"electron:mac": "npm run build:prod && electron-builder build --mac",
Expand Down Expand Up @@ -89,45 +88,5 @@
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS && npm run lint"
}
},
"build": {
"appId": "com.jhonatanmedeiros.webview-angular-electron",
"productName": "Webview Angular Electron",
"copyright": "Copyright © 2020 ${author}",
"dmg": {
"contents": [
{
"x": 130,
"y": 220
},
{
"x": 410,
"y": 220,
"type": "link",
"path": "/Applications"
}
]
},
"win": {
"target": [
"nsis",
"msi"
]
},
"linux": {
"category": "Development",
"packageCategory": "Development",
"target": [
"deb",
"snap",
"AppImage"
],
"desktop": {
"Encoding": "UTF-8"
}
},
"directories": {
"buildResources": "resources"
}
}
}
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes

0 comments on commit 325c986

Please sign in to comment.