DEV Community

Cover image for Cross-compile a distributed Electron App

Cross-compile a distributed Electron App

Another quick post, I see a lot of developers would rather complain on github than go into hacker mode and solve their issue.

My last post around LiveCaptioning mentions WhisperScript a macOS only electron app. On the thread there are (rightly so) 50ish complaints about it not being availalbe for Windows or Linux.

Let's fix that! Electron was great back in the day, but security was never one of them. A lot of these app even commercially distributed unknowingly I hope, ship there source code. 🫨🫨🫨

An electron package app format is called ASAR, and luckily for us you can unpack it, it's basically a zip or rar type compression format.

Easiest if you can install to say mac then right click and show package contents.

Image description

Let's find the ASAR here, Contents/Resources

Image description

Now one liner npx asar pack untouched app.asar

Naviagte to the newly created "app" folder install the deps eg. yarn

and repackage npx electron-forge package --platform=win32 --arch="x64"

windows users rejoice, there may be additional fiddling with native binaries etc but this is 90% the work.

It is important to of course only do this on properly licensed (APACHE etc) or rather unlicensed software.

We are in luck
Image description

Top comments (1)

Collapse
 
jswhisperer profile image
Greg, The JavaScript Whisperer

If you are compiling from macOS to Windows you will need Wine... to drink optional but the app. brew install --cask wine-stable