electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.57k stars 1.73k forks source link

Customize installer for Mac #8064

Closed aishahsofea closed 3 weeks ago

aishahsofea commented 6 months ago

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.

mmaietta commented 6 months ago

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.

aishahsofea commented 6 months ago

@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.

Screenshot 2024-02-21 at 12 13 06 AM
mmaietta commented 6 months ago

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 🙂 )

KaminoRyo commented 6 months ago

@aishahsofea Oh, The approach suggested by mmaietta should be fine, but there is another problem. Also see #8063

aishahsofea commented 6 months ago

@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/42850950

It 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?

KaminoRyo commented 6 months ago

Sorry, but I don't know about that. After searching, I found the following articles to be helpful.

aishahsofea commented 6 months ago

@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.

mmaietta commented 6 months ago

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

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] commented 3 weeks ago

This issue was closed because it has been stalled for 30 days with no activity.