I have successfully set icon for my electron app on MacOS and Windows OS with the icon file in the build folder, configuration on the package.json.
"build": {
...,
"mac": {
"icon": "build/icon.icns"
},
"win": {
"icon": "build/icon.png"
},
"linux": {
"icon": "build/icon.png"
},
},
However the linux platform seems to not working.
I also try to create the icons folder inside the build folder(./build/icons) as documented https://www.electron.build/icons.html which then paste the 512x512.png icon to there but nothing change after building the app.
Related
I have an electron app which I would like to automatically update and to do that I am using electron-updater. It seems all the working parts are together but I cannot have the Release Notes. Here's my script to package and upload it to S3.
"package": "electron-builder build --publish always",
And here's my build
"mac": {
"category": "my.category.app",
"target": [{
"target": "dmg",
"arch": [
"arm64",
"x64"
]
}, {
"target": "zip",
"arch": [
"arm64",
"x64"
]
}],
"type": "distribution",
"hardenedRuntime": true,
"gatekeeperAssess": false,
"publish": {
"provider": "s3",
"bucket": "my-bucket-name",
"publishAutoUpdate": true
}
},
Now when I run the package, it packages the app and uploads it in my S3 bucket. I can see that all the zip, dmg and blockmap files for both x64 and arm64 are already uploaded and in addition to them, I also have the latest-mac.yml file.
When I run the app on dev, I can see that it recognizes that there is an update available and it downloads it automatically and when it is already downloaded, I can see that there is no release notes in the latest-mac.yml file. But I would like to have that as well so I can display it to my users before they accept to install it.
Any idea how to do that? Really appreciate it.
Previously we were using .dmg target and published on the S3 bucket, So on S3 and electron app it creates latest-mac.yml and app-update.yml files automatically, and for the next version app automatically update.
But Right now we are using target as .pkg . The auto-updater is now stopped. latest-mac.yml and app-update.yml are not creating for .pkg target. But build uploaded to s3 successfully.
package.json
"package-ci": "yarn postinstall && yarn build && electron-builder --publish always",
.....
"mac": {
"entitlements": "build/entitlements.mac.inherit.plist",
"entitlementsInherit": "build/entitlements.mac.inherit.plist",
"icon": "./resources/icon.png",
"target": [
"pkg"
]
},
........
"publish": {
"provider": "s3",
"bucket": "build",
}
I use electron-forge and WIX to build installer on Windows. But I found that if there is a version number specified in package.json, then the installed folder will contain a subfolder with this specific version number appended.
For instance, if the version is "1.2.3+4", then inside the installed folder we get
app-1.2.3+4
This is problematic if we install new versions onto the same folder, which will litter all the old version files/folders in the same parent folder. I'd love new versions to simply overwrite that folder. How to get rid of this version number from the subfolder without affecting the versioning elsewhere?
Here is my wix setup inside package.json
"makers": [
{
"name": "#electron-forge/maker-wix",
"platforms": [
"win32"
],
"config": {
"arch": "x64",
"appUserModelId": "com.company.myapp",
"description": "description of myapp",
"exe": "myapp",
"appIconPath": "C:\\Temp\\myapp.ico",
"language": 1033,
"manufacturer": "mycompany",
"name": "My App",
"programFilesFolderName": "MyApp",
"shortName": "myapp",
"shortcutFolderName": "My App",
"ui": {
"chooseDirectory": true,
"images": {
"background": "C:\\Temp\\background-orange.png",
"banner": "C:\\Temp\\banner-orange.png"
}
},
"version": "1.2.3+4"
}
}
]
}
},
I am developing an electron application where I am using external .exe files. In development mode application works fine.
But when I package the application, it is unable to find those .exe files.
How to include .exe files in packaged application. I am using electron-builder for packaging.
Below is my configuration,
"build": {
"appId": "com.f.quickstart",
"files": [
"app/build/**/*",
"app/build/**/*.exe",
"main.js",
"mainIPC.js",
"src/**/*",
"dist/**/*",
"node_modules/**/*",
"package.json"
],
"win": {
"target": "portable",
"signAndEditExecutable": false
},
"linux": {
"target": "AppImage"
},
"mac": {
"target": "zip"
}
}
Looking for help.
Thanks
I'm trying to package my recent electron app. I tried to use electron-packager and I actually build the app though it is a bunch of files.
Now I'm facing some problems:
How do I change the app icon? I did it by setting its path in BrowserWindow creation, but shouldn't I be able to do it with electron packager?
And what about the actual desktop icon?
And finally how should I do to package all the files built by electron-packager in one .exe?
I'm building it in windows for windows architecture.
Oh i have faced that problem. first of all i'll leave you an example of how to use the API of electron-packager
var packager = require('electron-packager');
var options = {
'arch': 'ia32',
'platform': 'win32',
'dir': './',
'app-copyright': 'Paulo Galdo',
'app-version': '2.0.5',
'asar': true,
'icon': './app.ico',
'name': 'TierraDesktop',
'ignore': ['./releases', './.git'],
'out': './releases',
'overwrite': true,
'prune': true,
'version': '1.3.2',
'version-string':{
'CompanyName': 'Paulo Galdo',
'FileDescription': 'Tierra de colores', /*This is what display windows on task manager, shortcut and process*/
'OriginalFilename': 'TierraDesktop',
'ProductName': 'Tierra de colores',
'InternalName': 'TierraDesktop'
}
};
packager(options, function done_callback(err, appPaths) {
console.log(err);
console.log(appPaths);
});
Here i left you the link with all the information. Electron packager API
And finally a module so you can build your installer easily, just follow their API.
Windows installer
electron-builder is an all in one packager that will create a Windows installer (or other platforms) and allow you to set icons and many other settings. It actually uses electron-packager as a dependency for the actual packaging.
https://github.com/electron-userland/electron-builder
In Package.json
{
"name": "APP_NAME",
"version": "6.1.0",
"description": "About APP",
"main": "main.js",
"scripts": {
"preinstall": "npm i -g electron-packager",
"start": "electron .",
"package-win32": "electron-packager ./ APP_NAME --overwrite --platform=win32 --arch=ia32 --icon=assets/YOUR_Icon.ico --out=release-builds --app-copyright=\"Copyright © COMPANY_NAME 2020\" --version-string.CompanyName=COMPANY_NAME"
},
"author": "YOUR NAME",
"license": "YOUR LICENSE",
"devDependencies": {
"electron": "^2.0.0",
"electron-packager": "^12.2.0"
}
}