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
Direct Download
Read full article as PDF:
Price $2.95
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Find SysAdmin Jobs
News
-
SparkyLinux 6.6 Now Available for Installation
The Debian-based SparkyLinux has a new point release that retools the live USB desktop creator and other changes that give it shiny new-ness.
-
SparkyLinux 6.6 Now Available for Installation
The Debian-based SparkyLinux has a new point release that retools the live USB desktop creator and other changes that give it shiny new-ness.
-
Escuelas Linux 8.0 Now Available
Just in time for its 25th anniversary, the developers of Escuelas Linux have released the latest version.
-
LibreOffice 7.5 Loaded with New Features and Improvements
The favorite office suite of the Linux community has a new release that includes some visual refreshing and new features across all modules.
-
The Next Major Release of Elementary OS Has Arrived
It's been over a year since the developers of elementary OS released version 6.1 (Jólnir) but they've finally made their latest release (Horus) available with a renewed focus on the user.
-
KDE Plasma 5.27 Beta Is Ready for Testing
The latest beta iteration of the KDE Plasma desktop is now available and includes some important additions and fixes.
-
Netrunner OS 23 Is Now Available
The latest version of this Linux distribution is now based on Debian Bullseye and is ready for installation and finally hits the KDE 5.20 branch of the desktop.
-
New Linux Distribution Built for Gamers
With a Gnome desktop that offers different layouts and a custom kernel, PikaOS is a great option for gamers of all types.
-
System76 Beefs Up Popular Pangolin Laptop
The darling of open-source-powered laptops and desktops will soon drop a new AMD Ryzen 7-powered version of their popular Pangolin laptop.
-
Nobara Project Is a Modified Version of Fedora with User-Friendly Fixes
If you're looking for a version of Fedora that includes third-party and proprietary packages, look no further than the Nobara Project.