A boilerplate for using Angular2 to create multi-platform desktop apps in Electron. Currently runs with:
- Angular v4.0.0
- Angular-CLI v1.0.0
- Electron v1.6.2
- Electron-Packager v8.6.0
This app gives you the capability to:
- Run Angular2 in a local development environment in Electron
- Package your application into apps that run on Mac, Windows and Linux
- Build installers that run on Mac and Windows
- Global installs of Node.js (prfererably lastest v6.10.1), npm (preferably latest v3.10.10), @angular/cli (preferably latest v1.0.0), Electron (preferably latest v1.6.2) and Electron-Packager.
Clone this repository locally:
git clone https://github.com/stokingerl/Angular2-Electron-Boilerplate.git
Install dependencies:
npm install
Build angular2 code and run current app locally (DOES NOT CURRENTLY DO HOT RELOAD):
npm start
This should pop up your Angular2 in Electron:
To be able to use Developer tools, go to View > Toggle Developer Tools
. You should be able to fine all of your Angular2 code in the 'webpack' section of 'sources'.
npm run build-electron
- builds your Angular2 app and throws the result as well as your electron main.js file into the dist foldernpm start
- runsnpm run build-electron
and starts your app in electron by runningmain.js
npm run package-mac
- builds your application and generates a.app
file of your application that can be run on mac. NOTE: I am like 99% sure you need to be on a MAC OS machine to be able to run this.npm run package-windows
- builds your application and creates an app consumable in windows 32 bit systems. NOTE: If you build this on MAC OS or linux you need wine installed, which can be installed withbrew install wine
npm run package-linux
- builds your application and creates an app consumable on linux systems.npm run full-build-mac
- creates a.dmg
installer for mac platforms.npm run full-build-windows
- creates an installer for windows platforms.
This app is run with a simple Electron window. The code for this is managed at /src/electron/main.js
and any configuration can be altered there. Check out Electron for more information
This project was created intially with @angular/cli version 1.0.0, all angular-cli commands should work with this app. Even if you do ng build
and ng serve
, you can open the strictly web portion of this app in http://localhost:4200
. Check out Angular-CLI for more details.
Run npm run build-electron
to build the project. The build artifacts will be stored in the dist/
directory. Use the -prod
flag for a production build.
Run ng test
to execute the unit tests via Karma.
This boilerplate would not be possible without these repositories:
Recommended packages: