This project is the minimal structure to easily build an Electron based app using Haxe language.
- Haxe + Heaps engine to render 2D/3D in a WebGL canvas
- jQuery for all DOM manipulations (you can use something else if you prefer)
- Electron auto-updater (using Git releases)
You will need:
- Haxe compiler,
- NPM to install dependencies,
- My libs
deepnightLibs
for Haxe (see below), - VScode is recommended.
Please refer to this tutorial to install Haxe: Quick guide to install Haxe.
Run the following command to install my deepnightLibs
:
haxelib git deepnightLibs https://github.com/deepnight/deepnightLibs.git
Nothing special here, you probably know the drill.
Just go to the ElectronBase repository on GitHub and click on the "Use this template" button.
Learn more about GitHub templates here.
This method is quite similar to a fork:
- Make a new empty repo somewhere. It must be strictly empty: no LICENSE, no README, nothing.
- Clone it on your system
- Run:
git remote add electronBase https://github.com/deepnight/electronBase.git
git pull electronBase master
git push origin master
After retrieving the source code, open a command line in the root of the repo and run:
npm i
src/electron.main/
: Haxe source code for the Electron Main (ie. very first JS file to be ran on startup).src/electron.renderer/
: Haxe source code for the Electron Renderer (ie. the actual app browser window).src/bindinds/
: various extern bindings for Haxe (jQuery, electron auto-updater etc).electron/
: Electron related files (ie. application and redistributable assets)res/
: Heaps (webGL) resources, if any.
To build the Electron main JS:
haxe main.debug.hxml
To build the Electron renderer JS:
haxe renderer.debug.hxml
Alternatively, you can build non-debug files using:
haxe main.hxml
haxe renderer.hxml
Or:
npm run compile
To run the compiled app:
npm start
NOTE: for some obscure reason, this last command might not work. You can still run the app by either:
- using VScode, and executing
Start debugging
command. - run
npm run pack-test
to quickly create an unpacked redistributable, then execute the.exe
file in the/electron/redist/win-unpacked
folder.
Windows:
npm run pack-win
macOS (requires an actual OSX environment):
npm run pack-macos
Linux:
npm run pack-linux-x86