Exploring the Electron application framework
Porting
You can port the boilerplate app from Figure 2 to other desktop systems using the forge package
command. Without specifying options, the command (under Ubuntu 16.04) creates a standalone version for Linux and the existing x64 processor architecture in the out/app-linux-x64
subdirectory of the app
project folder. In addition to the approximately 80MB executable app
in ELF format, this directory also contains other binary files. You will find the web application and the required node packages under resources/app
. After switching to the directory, the ./app
command starts the app in the shell, which looks exactly like Figure 2.
You can port the app to Windows using the --platform
command-line switch in the forge package --platform win32
command. This command creates the app for 64-bit Windows in the out/app-win32-x64
folder. In addition to the executable app.exe
, the distribution contains a large number of Windows DLLs and the resources
folder, which is more or less bit-identical to the matching folder for Linux.
If you copy the folder from Linux to a Windows 10 system and start the app, you won't see any notable differences with Figure 2. Conversely, you could install electron-forge
under Windows 10, and, in that case, the Linux app created under Windows will run under Linux.
You can assign a processor architecture with the arch
command-line switch. Table 1 shows the possible combinations of values for platform
and arch
.
Table 1
Electron Compatibility
System | Version | IA-32 | x64 | ARMv7l | ARM64 |
---|---|---|---|---|---|
Ubuntu |
>=12.04 |
Yes |
Yes (tested) |
Yes |
Yes |
Debian |
8 |
Yes |
Yes |
Yes |
Yes |
Fedora |
21 |
Yes |
Yes |
Yes |
Yes |
Windows |
>=7 |
Yes |
Yes (tested) |
Yes |
Yes |
OS X |
>=10.9 |
No |
Yes |
No |
Yes |
Packing
forge
offers to create platform-specific package formats or installers to facilitate easy distribution of the app (Table 2). forge make
generates a Debian package for the Boilerplate app. However, the script terminated in our lab while trying to create an RPM package, with the error message from Figure 3. sudo apt-get install rpm
fixed the problem.
Table 2
Possible Package Formats under forge
Type | System | Description |
---|---|---|
zip |
All |
Zip archive |
squirrel |
Windows |
Installer for Squirrel-Dot-Windows |
appx |
Windows |
Windows-Store packet |
dmg |
OS X Darwin |
DMG packet |
deb |
Linux |
Debian packet |
rpm |
Linux |
RPM packet |
flatpack |
Linux |
Flatpack packet |
Similar scenes occurred while trying to create a Windows installer with the forge make --platform win32
command. In this case, .NET support was missing:
sudo apt-get install mono wine
Under out/make/squirell.Windows/x64
, you will find the app-1.0.0 Setup.exe
installer file, which we were able to install on Windows 10 without any problems.
Listing 3 displays the configuration object [11] from the package.json
file as a portal. Lines 2 to 13 contain the package formats to be generated in the make_targets
sub-object, listed by operating system.
Listing 3
Configuration of forge
01 [...] 02 "forge": { 03 "make_targets": { 04 "win32": [ 05 "squirrel" 06 ], 07 "darwin": [ 08 "zip" 09 ], 10 "linux": [ 11 "deb", 12 "rpm" 13 ] 14 }, 15 "electronPackagerConfig": { 16 "packageManager": "yarn" 17 }, 18 "electronWinstallerConfig": { 19 "name": "app" 20 }, 21 "electronInstallerDebian": {}, 22 "electronInstallerRedhat": {}, 23 "github_repository": { 24 "owner": "", 25 "name": "" 26 }, 27 "windowsStoreConfig": { 28 "packageName": "", 29 "name": "app" 30 } 31 } 32 [...]
Conclusions
Electron makes it easy to create desktop apps using popular web technologies such as HTML, CSS, and JavaScript. At the same time, Electron offers an infrastructure that can port apps to other systems via the command line.
Compared to Cordova Phone Gap [12], the installation is trivial, even if support for mobile operating systems such as Android or iOS is currently missing. If you want to be on the safe side, simply pack on the target system each time and test the app immediately.
Infos
- Electron: https://electronjs.org
- Chromium: https://www.chromium.org
- Node.js: https://nodejs.org
- Bootstrap: https://getbootstrap.com
- React: https://reactjs.org
- Angular: https://angular.io
- JQuery: https://jquery.com
- Yarn: https://yarnpkg.com
electron-forge
: https://github.com/electron-userland/electron-forge- Boilerplate projects: https://github.com/sindresorhus/awesome-electron#boilerplates
- Configuration of
electron-forge
: https://github.com/electron-userland/electron-forge#config - Phone Gap: https://phonegap.com
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs
-
Juno Computers Launches Another Linux Laptop
If you're looking for a powerhouse laptop that runs Ubuntu, the Juno Computers Neptune 17 v6 should be on your radar.
-
ZorinOS 17.1 Released, Includes Improved Windows App Support
If you need or desire to run Windows applications on Linux, there's one distribution intent on making that easier for you and its new release further improves that feature.
-
Linux Market Share Surpasses 4% for the First Time
Look out Windows and macOS, Linux is on the rise and has even topped ChromeOS to become the fourth most widely used OS around the globe.
-
KDE’s Plasma 6 Officially Available
KDE’s Plasma 6.0 "Megarelease" has happened, and it's brimming with new features, polish, and performance.
-
Latest Version of Tails Unleashed
Tails 6.0 is based on Debian 12 and includes GNOME 43.
-
KDE Announces New Slimbook V with Plenty of Power and KDE’s Plasma 6
If you're a fan of KDE Plasma, you'll be thrilled to hear they've announced a new Slimbook with an AMD CPU and the latest version of KDE Plasma desktop.
-
Monthly Sponsorship Includes Early Access to elementary OS 8
If you want to get a glimpse of what's in the pipeline for elementary OS 8, just set up a monthly sponsorship to help fund its continued existence.
-
DebConf24 to be Held in South Korea
Busan will be the location of the latest DebConf running July 28 through August 4