├── .gitignore ├── LICENSE ├── README.md ├── app ├── Gulpfile.js ├── browser │ ├── config.js │ ├── index.html │ └── scripts │ │ └── splash │ │ ├── app.js │ │ └── controller.js ├── main │ ├── index.es6.js │ └── index.js └── package.json └── server ├── package.json └── server.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | jspm_packages 3 | *.swp 4 | .DS_Store 5 | package 6 | dist 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Thorsten Hans 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # App Boilerplate for Electron 2 | 3 | This is a fork of the work of Thorsten Hans (original README below), corrected, completed, updated and adapted to my needs. 4 | 5 | ---------------- 6 | original README (at time of fork): 7 | ---------------- 8 | # Sample App for Electron 9 | 10 | For more details see the post on my blog [http://www.dotnet-rocks.com/2015/05/04/writing-an-electron-atom-shell-app-using-angular-and-es6/](http://www.dotnet-rocks.com/2015/05/04/writing-an-electron-atom-shell-app-using-angular-and-es6/) 11 | 12 | 13 | ## PreConditions for client 14 | 15 | Ensure that the following node packages are installed on your system 16 | 17 | * jspm 18 | 19 | you can install it using `npm i jspm -g` 20 | 21 | 22 | ## Install dependencies 23 | 24 | After cloning the repo execute `npm i` in both subdirectories `app` and `server` to install all dependencies. For the client, `jspm install` will be invoked automatically as `npm postinstall` script! 25 | 26 | ## Creating the Electorn App package 27 | 28 | Execute `gulp` in order to build the electron app. 29 | 30 | The final electron app will be located as a zip file within the `dist` subfolder. Extract the ZIP file and start the electron app. 31 | 32 | ## Demonstrating CrashReporter 33 | 34 | For demonstrating the `crash-reporter` you've to start the little `express` server from the `server` subfolder by invoking `node server.js` before crashing the app using the button... 35 | -------------------------------------------------------------------------------- /app/Gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'), 2 | babel = require('gulp-babel'), 3 | runSequence = require('run-sequence'), 4 | rename = require('gulp-rename'), 5 | electron = require('gulp-atom-electron'), 6 | del = require('del'); 7 | 8 | gulp.task('transpile:app', function() { 9 | return gulp.src('main/index.es6.js') 10 | .pipe(babel()) 11 | .pipe(rename('index.js')) 12 | .pipe(gulp.dest('main')); 13 | }); 14 | 15 | 16 | gulp.task('clean', function(){ 17 | return del('package', {force: true}); 18 | }); 19 | 20 | gulp.task('copy:app', ['clean'], function(){ 21 | return gulp.src(['main/**/*', 'browser/**/*', 'package.json'], {base: '.'}) 22 | .pipe(gulp.dest('package')); 23 | }); 24 | 25 | 26 | gulp.task('build', function() { 27 | return gulp.src('package/**') 28 | .pipe(electron({ 29 | version: '0.30.3', 30 | // build for OSX 31 | platform: 'darwin' })) 32 | .pipe(electron.zfsdest('dist/es6-ng-electron.zip')); 33 | }); 34 | 35 | gulp.task('default', function(){ 36 | return runSequence('clean', 'transpile:app', 'copy:app','build'); 37 | }); 38 | -------------------------------------------------------------------------------- /app/browser/config.js: -------------------------------------------------------------------------------- 1 | System.config({ 2 | baseURL: ".", 3 | defaultJSExtensions: true, 4 | transpiler: "babel", 5 | babelOptions: { 6 | "optional": [ 7 | "runtime", 8 | "optimisation.modules.system" 9 | ] 10 | }, 11 | paths: { 12 | "github:*": "jspm_packages/github/*", 13 | "npm:*": "jspm_packages/npm/*" 14 | }, 15 | 16 | map: { 17 | "angular": "github:angular/bower-angular@1.4.6", 18 | "babel": "npm:babel-core@5.8.25", 19 | "babel-runtime": "npm:babel-runtime@5.8.24", 20 | "core-js": "npm:core-js@1.1.4", 21 | "github:jspm/nodelibs-process@0.1.1": { 22 | "process": "npm:process@0.10.1" 23 | }, 24 | "npm:babel-runtime@5.8.24": { 25 | "process": "github:jspm/nodelibs-process@0.1.1" 26 | }, 27 | "npm:core-js@1.1.4": { 28 | "fs": "github:jspm/nodelibs-fs@0.1.2", 29 | "process": "github:jspm/nodelibs-process@0.1.1", 30 | "systemjs-json": "github:systemjs/plugin-json@0.1.0" 31 | } 32 | } 33 | }); 34 | -------------------------------------------------------------------------------- /app/browser/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Electron / Angular / ES6 Sample 5 | 6 | 7 | 10 | 11 | 12 |

Electron / Angular / ES6 Sample

13 |
14 |
15 |

You're running Electron version 16 | 17 |

18 | 19 | 20 | 21 |
22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /app/browser/scripts/splash/app.js: -------------------------------------------------------------------------------- 1 | import angular from 'angular'; 2 | import { 3 | SplashCtrl 4 | } 5 | from './controller'; 6 | 7 | angular.module('sampleApp', []) 8 | .controller('splashCtrl', SplashCtrl); -------------------------------------------------------------------------------- /app/browser/scripts/splash/controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | class SplashCtrl { 4 | 5 | 6 | 7 | constructor() { 8 | this.electronVersion = process.versions['electron']; 9 | } 10 | 11 | doCrash(){ 12 | var ipc = require('ipc'); 13 | ipc.send('crash', 'Something bad happened...'); 14 | } 15 | 16 | openDevTools() { 17 | var ipc = require('ipc'); 18 | ipc.send('devTools', null); 19 | } 20 | 21 | 22 | } 23 | export { 24 | SplashCtrl 25 | }; -------------------------------------------------------------------------------- /app/main/index.es6.js: -------------------------------------------------------------------------------- 1 | let app = require('app'); 2 | let ipc = require('ipc'); 3 | let crashReporter = require('crash-reporter'); 4 | let BrowserWindow = require('browser-window'); 5 | 6 | 7 | crashReporter.start({ 8 | productName: 'es6-ng-electron', 9 | companyName: 'FooBar', 10 | submitUrl: 'http://localhost:3000/', 11 | autoSubmit: true 12 | }); 13 | 14 | var mainWindow = null; 15 | 16 | ipc.on('crash', (event, arg)=>{ 17 | process.crash(arg); 18 | }); 19 | 20 | ipc.on('devTools', (event,arg) =>{ 21 | mainWindow.openDevTools(); 22 | }); 23 | 24 | app.on('window-all-closed', () => { 25 | // force app termination on OSX when mainWindow has been closed 26 | if (process.platform == 'darwin') { 27 | app.quit(); 28 | } 29 | }); 30 | 31 | app.on('ready', () => { 32 | mainWindow = new BrowserWindow({ 33 | width: 800, 34 | height: 600 35 | }); 36 | 37 | mainWindow.loadUrl('file://' + __dirname + '/../browser/index.html'); 38 | mainWindow.webContents.on('did-finish-load',() =>{ 39 | mainWindow.setTitle(app.getName()); 40 | }); 41 | mainWindow.on('closed', () => { 42 | mainWindow = null; 43 | }); 44 | }); 45 | -------------------------------------------------------------------------------- /app/main/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var app = require('app'); 4 | var ipc = require('ipc'); 5 | var crashReporter = require('crash-reporter'); 6 | var BrowserWindow = require('browser-window'); 7 | 8 | crashReporter.start({ 9 | productName: 'es6-ng-electron', 10 | companyName: 'FooBar', 11 | submitUrl: 'http://localhost:3000/', 12 | autoSubmit: true 13 | }); 14 | 15 | var mainWindow = null; 16 | 17 | ipc.on('crash', function (event, arg) { 18 | process.crash(arg); 19 | }); 20 | 21 | ipc.on('devTools', function (event, arg) { 22 | mainWindow.openDevTools(); 23 | }); 24 | 25 | app.on('window-all-closed', function () { 26 | // force app termination on OSX when mainWindow has been closed 27 | if (process.platform == 'darwin') { 28 | app.quit(); 29 | } 30 | }); 31 | 32 | app.on('ready', function () { 33 | mainWindow = new BrowserWindow({ 34 | width: 800, 35 | height: 600 36 | }); 37 | 38 | mainWindow.loadUrl('file://' + __dirname + '/../browser/index.html'); 39 | mainWindow.webContents.on('did-finish-load', function () { 40 | mainWindow.setTitle(app.getName()); 41 | }); 42 | mainWindow.on('closed', function () { 43 | mainWindow = null; 44 | }); 45 | }); -------------------------------------------------------------------------------- /app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-sample", 3 | "version": "1.0.0", 4 | "description": "My first electron app", 5 | "main": "main/index.js", 6 | "scripts": { 7 | "postinstall": "jspm install" 8 | }, 9 | "keywords": [ 10 | "electron-app" 11 | ], 12 | "author": "Thorsten Hans", 13 | "repository": "https://github.com/ofi/electron-angular-es6", 14 | "license": "MIT", 15 | "devDependencies": { 16 | "del": "^1.2.0", 17 | "gulp": "^3.9.0", 18 | "gulp-atom-electron": "^0.12.0", 19 | "gulp-babel": "^5.1.0", 20 | "gulp-rename": "^1.2.2", 21 | "run-sequence": "^1.1.2" 22 | }, 23 | "jspm": { 24 | "directories": { 25 | "baseURL": "browser" 26 | }, 27 | "dependencies": { 28 | "angular": "github:angular/bower-angular@^1.3.15" 29 | }, 30 | "devDependencies": { 31 | "babel": "npm:babel-core@^5.8.24", 32 | "babel-runtime": "npm:babel-runtime@^5.8.24", 33 | "core-js": "npm:core-js@^1.1.4" 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "server", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "connect-multiparty": "^2.0.0", 13 | "express": "^4.13.3" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /server/server.js: -------------------------------------------------------------------------------- 1 | var express = require('express'), 2 | multipart = require('connect-multiparty'); 3 | 4 | var multipartMiddleware = multipart(); 5 | 6 | var app = express(); 7 | 8 | 9 | app.post('/', multipartMiddleware, function (req, res) { 10 | console.dir(req.body); 11 | res.sendStatus(200); 12 | }); 13 | 14 | var server = app.listen(3000, function () { 15 | var host = server.address().address; 16 | var port = server.address().port; 17 | 18 | console.log('Example app listening at http://%s:%s', host, port); 19 | }); --------------------------------------------------------------------------------