From 6b2df09690d23cac61ab2b0007b4485c4536a874 Mon Sep 17 00:00:00 2001 From: Felix Rieseberg Date: Tue, 30 May 2017 15:22:18 -0700 Subject: [PATCH] :wrench: Introduce electron-forge --- README.md | 4 ++ package.json | 55 +++++++++++++----- main.js => src/main/main.js | 2 +- index.html => src/renderer/index.html | 22 +++---- {lib => src/renderer/lib}/check-node.js | 0 {lib => src/renderer/lib}/examples.js | 0 {lib => src/renderer/lib}/install.js | 0 {lib => src/renderer/lib}/load.js | 0 {lib => src/renderer/lib}/versions.js | 0 browser.js => src/renderer/renderer.js | 6 +- {images => static/images}/lgoonodejswhite.png | Bin .../images}/nodejs-new-white-bw.png | Bin .../images}/nodejs-new-white-pantone.png | Bin {images => static/images}/schoolhouse.svg | 0 style.css => static/style.css | 0 15 files changed, 58 insertions(+), 31 deletions(-) rename main.js => src/main/main.js (96%) rename index.html => src/renderer/index.html (70%) rename {lib => src/renderer/lib}/check-node.js (100%) rename {lib => src/renderer/lib}/examples.js (100%) rename {lib => src/renderer/lib}/install.js (100%) rename {lib => src/renderer/lib}/load.js (100%) rename {lib => src/renderer/lib}/versions.js (100%) rename browser.js => src/renderer/renderer.js (97%) rename {images => static/images}/lgoonodejswhite.png (100%) rename {images => static/images}/nodejs-new-white-bw.png (100%) rename {images => static/images}/nodejs-new-white-pantone.png (100%) rename {images => static/images}/schoolhouse.svg (100%) rename style.css => static/style.css (100%) diff --git a/README.md b/README.md index 8f4ec21..bb369ed 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,10 @@ npm install && npm start Learn more about Electron and its API in the [documentation](http://electron.atom.io/docs/latest). +## To build + +This installer can be built for Windows, macOS, and Linux. Calling `npm run make` will create packages for the current platform. On Windows, it will create a `zip` file and self-contained Squirrel installer. On macOS, it will create a `dmg` and `zip` file. On Linux, it will create both a `deb` and a `rpm` package. The configuration for those packages can be found in `package.json`. + ## Tests and Linting This project uses [StandardJS](http://standardjs.com/) as its style guide. diff --git a/package.json b/package.json index 3ee758a..fa44434 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,45 @@ { "name": "installer", "version": "0.1.0", - "description": "**Clone and run for a quick way to see an Electron in action.**", - "main": "main.js", + "productName": "node-installer", + "description": "An Electron application for installing, updating and managing versions of Node.js.", + "main": "src/main/main.js", + "scripts": { + "start": "electron-forge start", + "package": "electron-forge package", + "make": "electron-forge make", + "test": "standard" + }, + "keywords": [], + "author": "Mikeal Rogers (http://www.mikealrogers.com)", + "license": "Apache-2.0", + "config": { + "forge": { + "make_targets": { + "win32": [ + "squirrel", + "zip" + ], + "darwin": [ + "zip" + ], + "linux": [ + "deb", + "rpm" + ] + }, + "electronPackagerConfig": { + "appBundleId": "org.nodejs.installer" + }, + "electronWinstallerConfig": { + "name": "installer" + }, + "electronInstallerDebian": {}, + "electronInstallerRedhat": {} + } + }, "dependencies": { + "electron-compile": "^6.4.1", "electron-sudo": "^3.0.8", "flexboxgrid": "^6.3.1", "font-awesome": "^4.6.3", @@ -15,20 +51,7 @@ "yo-yo": "^1.2.2" }, "devDependencies": { - "electron-builder": "^5.10.5", - "electron-prebuilt": "^1.2.5", + "electron-prebuilt-compile": "1.6.11", "standard": "^7.1.2" - }, - "scripts": { - "start": "electron .", - "pack": "build --dir", - "dist": "build", - "test": "standard" - }, - "keywords": [], - "author": "Mikeal Rogers (http://www.mikealrogers.com)", - "license": "Apache-2.0", - "build": { - "appId": "org.nodejs.installer" } } diff --git a/main.js b/src/main/main.js similarity index 96% rename from main.js rename to src/main/main.js index c4aebe5..6deb863 100644 --- a/main.js +++ b/src/main/main.js @@ -17,7 +17,7 @@ function createWindow () { }) // and load the index.html of the app. - mainWindow.loadURL(`file://${__dirname}/index.html`) + mainWindow.loadURL(`file://${__dirname}/../renderer/index.html`) // Open the DevTools. mainWindow.webContents.openDevTools() diff --git a/index.html b/src/renderer/index.html similarity index 70% rename from index.html rename to src/renderer/index.html index 2278076..5ca855b 100644 --- a/index.html +++ b/src/renderer/index.html @@ -3,17 +3,17 @@ Node.js Installer - - - - + + + +
- +
@@ -21,7 +21,7 @@

Installed version:

@@ -29,17 +29,17 @@

Latest versions:

- +
@@ -76,7 +76,7 @@

Installing Node.js

Return to installer
- - + + diff --git a/lib/check-node.js b/src/renderer/lib/check-node.js similarity index 100% rename from lib/check-node.js rename to src/renderer/lib/check-node.js diff --git a/lib/examples.js b/src/renderer/lib/examples.js similarity index 100% rename from lib/examples.js rename to src/renderer/lib/examples.js diff --git a/lib/install.js b/src/renderer/lib/install.js similarity index 100% rename from lib/install.js rename to src/renderer/lib/install.js diff --git a/lib/load.js b/src/renderer/lib/load.js similarity index 100% rename from lib/load.js rename to src/renderer/lib/load.js diff --git a/lib/versions.js b/src/renderer/lib/versions.js similarity index 100% rename from lib/versions.js rename to src/renderer/lib/versions.js diff --git a/browser.js b/src/renderer/renderer.js similarity index 97% rename from browser.js rename to src/renderer/renderer.js index f81bff2..5a8f38b 100644 --- a/browser.js +++ b/src/renderer/renderer.js @@ -4,7 +4,7 @@ const semver = require('semver') const getInstalledVersion = require('./lib/check-node') -const loadVersions = require('./lib/load.js') +const loadVersions = require('./lib/load') const installNode = require('./lib/install') const getExample = require('./lib/examples') @@ -17,11 +17,11 @@ const major = v => v.split('.')[0] const installing = { run: false, - start() { + start () { domElement('#installing').style.display = 'block' this.run = true }, - done() { + done () { domElement('#installing').style.display = 'none' this.run = false } diff --git a/images/lgoonodejswhite.png b/static/images/lgoonodejswhite.png similarity index 100% rename from images/lgoonodejswhite.png rename to static/images/lgoonodejswhite.png diff --git a/images/nodejs-new-white-bw.png b/static/images/nodejs-new-white-bw.png similarity index 100% rename from images/nodejs-new-white-bw.png rename to static/images/nodejs-new-white-bw.png diff --git a/images/nodejs-new-white-pantone.png b/static/images/nodejs-new-white-pantone.png similarity index 100% rename from images/nodejs-new-white-pantone.png rename to static/images/nodejs-new-white-pantone.png diff --git a/images/schoolhouse.svg b/static/images/schoolhouse.svg similarity index 100% rename from images/schoolhouse.svg rename to static/images/schoolhouse.svg diff --git a/style.css b/static/style.css similarity index 100% rename from style.css rename to static/style.css