stephnr / electron-angular-boilerplate

An Electron template app using AngularJS, Skeleton and a whoe sleuth of tools for building Windows/Mac/Linux desktop applications
MIT License
138 stars 40 forks source link

Electron-Boilerplate

A template for Electron projects to build/publish Mac/Windows/Linux compatible applications

Circle CI Dependency Status devDependency Status

Table of Contents:


  1. Installation
  2. The Stack
  3. Adding new views
  4. Adding/Managing Bower Resources
  5. Building the Desktop Application
  6. Testing
  7. FAQ
  8. Contributing

Installation:

The application runs using Node 4.2.4. I recommend using nvm to manage your node versions. In addition, node-sass is required globally.

For development, run:

./scripts/load_globals.sh
sudo npm install --python=python2.7
bower install
npm start

Known Bugs:

Node-sass may fail the npm start command. I recommend running the following command to fix this:

npm i -g node-sass
npm rebuild node-sass

As for preparing the Windows/Mac/Linux apps for distribution. You will first need to run the npm install. Afterwards, run the following to build all the apps for all architectures and distributions:

# Requires GNU Make to be installed
make

The Stack:

The App Stack includes various tools and frameworks. Below is a list of those items and their intended purpose:

If you would like to suggest another tool or framework, please refer to the CONTRIBUTING.md before submitting an issue.

Adding new views

Thanks to the use of Gulp and Wiredep, it is recommended that all new views be written in the views directory as .html files in order to take advantage of the resource injection tool. The compiled views are then dumped into the same folder with all dependencies (even new ones) injected.

Adding/Managing Bower Resources

In order to add a new resource, simply install + save it using bower. Below is an example using jQuery

bower install --save jquery

And thats it. Since we are using Gulp + Wiredep, all bower dependencies will be included on pages supporting the Wiredep tags.

Building the Desktop Application

Since the app was built using Node.js, you only need to run the following command for development testing:

npm start

npm start will run the latest build and then launch the application.

In order to only build the latest code run:

gulp

As for building the final Desktop Application. You can use any of the following make commands to build them:

Alternatively, you can build all the apps at once by calling make apps

Testing

Tests are broken between two layers. All ES6 Modules/JS code should be tested using Jest. Alternatively, any testing for AngularJS content should be done using Karma/Jasmine. For more details on this, refer to the FAQ about Where to write tests.

FAQ:

  1. Where can I write my tests?

    All the ES6/Module tests are written in Jest. You can refer to the __tests__ folder for that. All test files for Jest should match against this file extension pattern *.jest.js. Alternatively, all AngularJS tests should be written using the following file extension pattern *.spec.js. These tests should be written within the b__tests__/app/ folder.

Contributing

Please see CONTRIBUTING.md for full details on contributing.