Ver Fonte

Merge branch 'packager' of github.com:thingsSDK/flasher.js into packager

Andrew Chalkley há 8 anos atrás
pai
commit
ea06e0c109
5 ficheiros alterados com 28 adições e 23 exclusões
  1. 4 4
      README.md
  2. 3 2
      back-end/rom_comm.js
  3. 8 13
      package.json
  4. 10 2
      scripts/pre-rebuild.js
  5. 3 2
      test/rom_comm_test.js

+ 4 - 4
README.md

@@ -22,8 +22,8 @@ EP-12 devices like the Adafruit Huzzah and Adadfruit Feather Huzzah.
 |---|:-----:|
 |Windows 10| Tested |
 |Windows 8.1| Tested |
-|Ubuntu 14.04 LTS|Tested|
-|Mac OS X 10.11|Tested|
+|Ubuntu 14.04 LTS| Tested |
+|Mac OS X 10.11| Tested |
 
 
 ## Device Compatibility
@@ -32,8 +32,8 @@ EP-12 devices like the Adafruit Huzzah and Adadfruit Feather Huzzah.
 |---|:-----:|-------|
 |[Adafruit Feather HUZZAH](https://www.adafruit.com/products/2821)|Tested|May require [driver](https://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx) installation. Automatically resets to bootloader mode on firmware upload.|
 |[Adafruit HUZZAH](https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout)|Tested|Requires [FTDI](https://www.adafruit.com/products/70) cable. To put device in to bootloader mode, hold `GPIO0` button while inserting USB in to your computer.|
-|[NodeMCU V3](http://www.banggood.com/V3-NodeMcu-Lua-WIFI-Development-Board-p-992733.html)|Tested|Requires installation of ch340g driver.  Information can be found [here](http://www.wemos.cc/tutorial/get_started_in_nodemcu.html).  For Mac there can be issues installing the driver.  Work around can be found [here](https://tzapu.com/making-ch340-ch341-serial-adapters-work-under-el-capitan-os-x/).|
-
+|[NodeMCU V3](http://www.banggood.com/V3-NodeMcu-Lua-WIFI-Development-Board-p-992733.html)|Tested|Requires installation of ch340g driver for macOS.  Information can be found [here](http://www.wemos.cc/tutorial/get_started_in_nodemcu.html).  For Mac there can be issues installing the driver.  Work around can be found [here](https://tzapu.com/making-ch340-ch341-serial-adapters-work-under-el-capitan-os-x/).|
+|[WiFi Witty](http://www.aliexpress.com/item/Smart-Electronics-ESP8266-serial-WIFI-Witty-cloud-Development-Board-ESP-12F-module-MINI-nodemcu/32597903268.html)|Tested|Requires installation of ch340g driver for macOS.  Information can be found [here](http://www.wemos.cc/tutorial/get_started_in_nodemcu.html).  For Mac there can be issues installing the driver.  Work around can be found [here](https://tzapu.com/making-ch340-ch341-serial-adapters-work-under-el-capitan-os-x/).|
 -------
 
 ## Run the GUI in Development

+ 3 - 2
back-end/rom_comm.js

@@ -2,7 +2,7 @@
 
 const EventEmitter = require("events");
 const fs = require("fs");
-const SerialPort = require("serialport").SerialPort;
+const SerialPort = require("serialport");
 const log = require("./logger");
 const slip = require("./streams/slip");
 const boards = require("./boards");
@@ -59,6 +59,7 @@ class RomComm extends EventEmitter {
     constructor(config) {
         super();
         this._port = new SerialPort(config.portName, {
+            autoOpen: false,
             baudRate: config.baudRate,
             parity: 'none',
             stopBits: 1,
@@ -66,7 +67,7 @@ class RomComm extends EventEmitter {
             xoff: false,
             rtscts: false,
             dsrdtr: false
-        }, false);
+        });
         this.bindPort();
         this.resetState();
         var boardName = config.boardName ? config.boardName : "Esp12";

+ 8 - 13
package.json

@@ -4,22 +4,21 @@
   "description": "A GUI tool for flashing the JavaScript runtimes and other firmware on to ESP8266 based microcontrollers and development boards",
   "main": "index.js",
   "scripts": {
-    "start": "electron .", 
+    "start": "electron .",
     "test": "mocha",
-
     "pre-rebuild": "node ./scripts/pre-rebuild.js",
-    "rebuild": "electron-rebuild",
-
+    "rebuild": "cd node_modules/serialport && node-gyp rebuild --target=1.2.5 --arch=x64 --dist-url=https://atom.io/download/atom-shell",
+   
     "pack-windows": "electron-packager . --asar --asar-unpack=protocol-link.html --overwrite --platform=win32 --arch=x64 --icon=resources/icon.ico --prune=true --out=out --version-string.CompanyName=ThingsSDK --version-string.FileDescription=Flasher.js --version-string.ProductName=Flasher.js",
     "pack-mac": "electron-packager . Flasher.js --asar --asar-unpack=protocol-link.html --overwrite --platform=darwin --arch=x64 --icon=resources/icon.icns --prune=true --out=out --osx-sign.identity='Developer ID Application: Secret Monkey Science'",
     "pack-linux": "electron-packager . --asar --asar-unpack=protocol-link.html --overwrite --platform=linux --arch=x64 --icon=resources/png/icon64.png --prune=true --out=out",
-
+  
     "sign-mac": "electron-osx-sign out/Flasher.js-darwin-x64/Flasher.js.app",
-
+   
     "installer-windows": "node ./scripts/windows-installer.js",
     "installer-mac": "electron-installer-dmg --overwrite --out=out/ out/Flasher.js-darwin-x64/Flasher.js.app Flasher.js --icon=resources/icon.icns --background=resources/drag_to_install.png",
     "installer-linux": "electron-installer-debian --src out/flasher.js-linux-x64/ --arch amd64 --config linux-config.json",
-
+  
     "dist-windows": "npm run pre-rebuild && npm run rebuild && npm run pack-windows && npm run installer-windows",
     "dist-linux": "npm run pre-rebuild && npm run rebuild && npm run pack-linux && npm run installer-linux",
     "dist-mac": "npm run pre-rebuild && npm run rebuild && npm run pack-mac && npm run sign-mac && npm run installer-mac"
@@ -53,19 +52,15 @@
     "bunyan": "^1.8.1",
     "decompress": "^4.0.0",
     "electron-squirrel-startup": "^1.0.0",
-    "node-binary": "^1.1.0",
     "request": "^2.72.0",
-    "serialport": "^2.0.7-beta1"
+    "rimraf": "^2.5.3",
+    "serialport": "4.0.0"
   },
   "devDependencies": {
     "chai": "^3.5.0",
-    "electron-installer-dmg": "^0.1.1",
-    "electron-osx-sign": "^0.4.0-beta4",
     "electron-packager": "^7.1.0",
     "electron-prebuilt": "^1.2.5",
-    "electron-rebuild": "^1.1.5",
     "electron-winstaller": "^2.3.1",
-    "jshint": "^2.9.2",
     "mocha": "^2.5.3"
   }
 }

+ 10 - 2
scripts/pre-rebuild.js

@@ -4,5 +4,13 @@ const rootPath = path.join(__dirname, '..')
 const nslog = path.join(rootPath, 'node_modules', 'nslog', 'build', 'Release', 'nslog.node');
 const serial_port = path.join(rootPath, 'node_modules', 'serialport', 'build', 'Release', 'serialport.node');
 
-fs.unlinkSync(nslog);
-fs.unlinkSync(serial_port);
+try {
+    fs.unlinkSync(nslog);
+} catch(e) {
+    //Eat error
+}
+try {
+    fs.unlinkSync(serial_port);
+} catch(e) {
+    //Eat error
+}

+ 3 - 2
test/rom_comm_test.js

@@ -7,7 +7,8 @@ describe('ESP8266', () => {
     const boards = require('../back-end/boards');
     it('defaults to the Esp12', () => {
         var esp = new RomComm({
-            portName: 'TEST'
+            portName: 'TEST',
+            baudRate: 9600
         });
         expect(esp.board).to.be.an.instanceof(boards.Esp12);
     });
@@ -16,7 +17,7 @@ describe('ESP8266', () => {
 describe('RomComm', () => {
    const esp = new RomComm({
        portName: "/dev/ttys000",
-       baud: 9600
+       baudRate: 9600
    });
    describe('handleResponse', () => {
        // Helper function for response creation, takes *args