浏览代码

Linux and Windows tweaks

Andrew Chalkley 9 年之前
父节点
当前提交
4fdc7892ed
共有 2 个文件被更改,包括 27 次插入15 次删除
  1. 18 7
      package.json
  2. 9 8
      scripts/windows-installer.js

+ 18 - 7
package.json

@@ -1,20 +1,28 @@
 {
 {
-  "name": "Flasher.js",
+  "name": "flasher.js",
   "version": "1.0.0",
   "version": "1.0.0",
-  "description": "A GUI tool for flashing the Espruino JavaScript runtime on Adafruit Huzzah (ESP8366 based) boards",
+  "description": "A GUI tool for flashing the Espruino JavaScript runtime on to SP8366 based boards",
   "main": "index.js",
   "main": "index.js",
   "scripts": {
   "scripts": {
-    "start": "electron index.js",
+    "start": "electron .", 
+    "test": "mocha",
+
     "pre-rebuild": "node ./scripts/pre-rebuild.js",
     "pre-rebuild": "node ./scripts/pre-rebuild.js",
     "rebuild": "electron-rebuild",
     "rebuild": "electron-rebuild",
-    "sign-mac": "electron-osx-sign out/Flasher.js-darwin-x64/Flasher.js.app",
+
     "pack-windows": "electron-packager . Flasher.js --asar  --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-windows": "electron-packager . Flasher.js --asar  --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 . --asar --overwrite --platform=darwin --arch=x64 --icon=resources/icon.icns --prune=true --out=out --osx-sign.identity='Developer ID Application: Secret Monkey Science'",
     "pack-mac": "electron-packager . --asar --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 --overwrite --platform=linux --arch=x64 --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-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",
+    "installer-mac": "electron-installer-dmg --overwrite --out=out/installers/ out/Flasher.js-darwin-x64/Flasher.js.app Flasher.js --icon=resources/icon.icns",
+    "installer-linux": "electron-installer-debian --src out/Flasher.js-linux-x64/ --dest out/installers/ --arch amd64",
+
     "dist-windows": "npm run pre-rebuild && npm run rebuild && npm run pack-windows && npm run installer-windows",
     "dist-windows": "npm run pre-rebuild && npm run rebuild && npm run pack-windows && npm run installer-windows",
-    "dist-mac": "npm run pack-mac && npm run sign-mac && npm run installer-mac",
-    "test": "mocha"
+    "dist-linux": "npm run pre-rebuild && npm run rebuild && npm run pack-linux",
+    "dist-mac": "npm run pack-mac && npm run sign-mac && npm run installer-mac"
   },
   },
   "repository": {
   "repository": {
     "type": "git",
     "type": "git",
@@ -25,6 +33,8 @@
     "adafruit",
     "adafruit",
     "huzzah",
     "huzzah",
     "esp8266",
     "esp8266",
+    "witty",
+    "nodemcu",
     "flasher"
     "flasher"
   ],
   ],
   "author": "Andrew Chalkley <andrew@chalkley.org>",
   "author": "Andrew Chalkley <andrew@chalkley.org>",
@@ -49,6 +59,7 @@
   },
   },
   "devDependencies": {
   "devDependencies": {
     "chai": "^3.5.0",
     "chai": "^3.5.0",
+    "electron-installer-debian": "^0.3.0",
     "electron-installer-dmg": "^0.1.1",
     "electron-installer-dmg": "^0.1.1",
     "electron-osx-sign": "^0.4.0-beta4",
     "electron-osx-sign": "^0.4.0-beta4",
     "electron-packager": "^7.1.0",
     "electron-packager": "^7.1.0",

+ 9 - 8
scripts/windows-installer.js

@@ -1,4 +1,5 @@
 
 
+"use strict";
 //Taken from Electron API Demos
 //Taken from Electron API Demos
 //https://github.com/electron/electron-api-demos/blob/master/script/installer.js
 //https://github.com/electron/electron-api-demos/blob/master/script/installer.js
 
 
@@ -10,20 +11,20 @@ deleteOutputFolder()
   .then(getInstallerConfig)
   .then(getInstallerConfig)
   .then(createWindowsInstaller)
   .then(createWindowsInstaller)
   .catch((error) => {
   .catch((error) => {
-    console.error(error.message || error)
-    process.exit(1)
-  })
+    console.error(error.message || error);
+    process.exit(1);
+  });
 
 
 function getInstallerConfig () {
 function getInstallerConfig () {
-  const rootPath = path.join(__dirname, '..')
-  const outPath = path.join(rootPath, 'out')
+  const rootPath = path.join(__dirname, '..');
+  const outPath = path.join(rootPath, 'out');
 
 
   return Promise.resolve({
   return Promise.resolve({
-    appDirectory: path.join(outPath, 'flasher.js-win32-x64'),
+    appDirectory: path.join(outPath, 'Flasher.js-win32-x64'),
     iconUrl: 'https://raw.githubusercontent.com/thingssdk/flasher.js/resources/icon.ico',
     iconUrl: 'https://raw.githubusercontent.com/thingssdk/flasher.js/resources/icon.ico',
     loadingGif: path.join(rootPath, 'resources', 'loading.gif'),
     loadingGif: path.join(rootPath, 'resources', 'loading.gif'),
     noMsi: true,
     noMsi: true,
-    outputDirectory: path.join(outPath, 'windows-installer'),
+    outputDirectory: path.join(outPath, 'installers', 'windows'),
     setupExe: 'FlasherjsSetup.exe',
     setupExe: 'FlasherjsSetup.exe',
     setupIcon: path.join(rootPath, 'resources', 'icon.ico'),
     setupIcon: path.join(rootPath, 'resources', 'icon.ico'),
     skipUpdateIcon: true
     skipUpdateIcon: true
@@ -32,7 +33,7 @@ function getInstallerConfig () {
 
 
 function deleteOutputFolder () {
 function deleteOutputFolder () {
   return new Promise((resolve, reject) => {
   return new Promise((resolve, reject) => {
-    rimraf(path.join(__dirname, '..', 'out', 'windows-installer'), (error) => {
+    rimraf(path.join(__dirname, '..', 'out', 'installers', 'windows'), (error) => {
       error ? reject(error) : resolve()
       error ? reject(error) : resolve()
     });
     });
   });
   });