electron-builder
electron-builder copied to clipboard
Customize installer for Mac
I am using electron-builder to package my electron app for Mac. I would like to allow my user to choose whether they can run the launcher app after installation is successful. Probably something like a checkbox. If it is being checked, and user click Close, the launcher will run. Is it possible at all to customize this? I can't find it anywhere in the documentation.
Is this a .pkg
target? I don't think that's possible to do so on mac, at least for .app
within a .dmg
since the process requires the user manually drag-dropping the .app
into /Applications
or other directory.
@mmaietta yes, it is a .pkg
target, and it does not require drag-dropping. I will need to go through these installation steps and clicking Close at the end will just close the installer. I'd like to add a checkbox at this step. Another alternative could be to automatically launch the launcher when closing the installer.
Can you try writing a postinstall
file to be included with the .pkg
?
I found this resource on a simple implementation
https://stackoverflow.com/a/42850950
It doesn't seem possible to change the installer dialog AFAICT. (Happy to be proven wrong though 🙂 )
@aishahsofea Oh, The approach suggested by mmaietta should be fine, but there is another problem. Also see #8063
@mmaietta
Can you try writing a
postinstall
file to be included with the.pkg
? I found this resource on a simple implementation https://stackoverflow.com/a/42850950It doesn't seem possible to change the installer dialog AFAICT. (Happy to be proven wrong though 🙂 )
That works, I could automatically run the launcher post installation. But i still want to give user the choice whether to run it or not. I'm thinking that maybe it's possible to create a script inside postinstall
file, where it will open a small popup window, and handles the UI & logic in this new window. @KaminoRyo do you know if this is possible?
Sorry, but I don't know about that. After searching, I found the following articles to be helpful.
@KaminoRyo that's helpful, but i'm facing another problem. Scripts inside postinstall is actually triggered during installation step. This makes user experience not smooth, because at installation step, a popup will appear that allows user to run launcher, and launcher will run. But seconds after, summary is shown saying "The installation was successful". I foresee this will create bad user experience
@mmaietta is there any alternative to postinstall
that will make sure script run at summary step, or better yet, once we click on Close button.
Well, pkg scripts only allow a pre/postinstall hook, so it makes sense that it's running as part of the "install" phase. pkg
installers are purely handled by macos system, I don't think it's possible to have it run after hitting the close confirmation on the installer dialog