israelg99 / angular2-electron

Starter project for angular2 and electron to develop multiplatform desktop applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

angular2-webpack-electron

Build Status Dependency Status devDependency Status

Forked originally from https://github.com/preboot/angular2-webpack

This repository adds some customization on top of the original repository to make it appropiate for electron apps instead of normal webpages.

Things to do yet

  • Look for a reliable method to run the e2e tests automatically
  • Add packaging/signing scripts to npm
  • Separate dev, test and production webpack configurations

Added some necessary files for electron

  • Added electron typings
  • Added index.js to load on electron

Scripts added/modified

This will run the build process and the application once.

npm run start

watch has been renamed to start-watch. The electron will start in livereload process. See electron livereload below.

npm run start-watch

##Electron livereload Support for electron livereload with electron-connect and on-webpack-build. When running start-watch script, the electron instance is run from the electron-connect client instead of running "electron ."

This code has been added to webpack to run the electron

var electron = require('electron-connect').server.create();
...
var isWatching = ENV === 'start-watch'
...
  if (isWatching) {
    config.plugins.push(
      new WebpackOnBuildPlugin(function(stats) {
        if (!config.reload) {
          config.reload = true;
          electron.start();
        } else {
          electron.reload();
        }
      })
    );
  }

Also this has been added to index.js, to run only when the npm lifecycle is start-watch

const livereload = require('electron-connect').client
...
const npm_lifecycle = process.env.npm_lifecycle_event
...
  if (npm_lifecycle === 'start-watch') {
    livereload.create(mainWindow)
  }

##Other

  • Deleted dependency and rules of development web servers.

About

Starter project for angular2 and electron to develop multiplatform desktop applications

License:MIT License


Languages

Language:JavaScript 73.2%Language:TypeScript 21.4%Language:CSS 2.8%Language:HTML 2.7%