feat(device): flash device firmware from Agent (#499)

* add dataModelVersion, usbProtocolVersion, slaveProtocolVersion

* read the package.json at appstart

* flash firmware

* update firmware

* fix extra resource path

* fix import modules

* update lock files

* fix imports

* terminal window

* exclude tmp folder from git repo

* ok button

* auto scroll in xterm

* fix maxTry count calculation

* optimize logging

* optimize timeout

* readSync

* Add extra delay

* fix async call

* fix error message in log

* fix ok button disable state

* retry

* list devices

* close device after reenumeration

* retry snooze

* kboot maxtry 10

* retry 100

* remove deprecated toPayload ngrx helper

* flash firmware with custom file

* fix tslint
This commit is contained in:
Róbert Kiss
2017-11-27 22:12:43 +01:00
committed by László Monda
parent f608791a09
commit 297fd3be79
52 changed files with 3914 additions and 894 deletions

View File

@@ -3,6 +3,8 @@ const jsonfile = require('jsonfile');
const exec = require('child_process').execSync;
const TEST_BUILD = process.env.TEST_BUILD;// set true if you would like to test on your local machine
// set true if running on your dev mac machine where yarn is installed or not need to install
const RUNNING_IN_DEV_MODE = process.env.RUNNING_IN_DEV_MODE === 'true';
const DIR = process.env.DIR;
// electron-builder security override.
@@ -40,11 +42,13 @@ if (!isReleaseCommit) {
process.exit(0)
}
if (process.platform === 'darwin') {
if (process.platform === 'darwin' && !RUNNING_IN_DEV_MODE) {
exec('brew install yarn --without-node');
}
exec("yarn add electron-builder");
if (!RUNNING_IN_DEV_MODE) {
exec("yarn add electron-builder");
}
const path = require('path');
const builder = require("electron-builder");
@@ -83,11 +87,13 @@ if (process.platform === 'darwin') {
//require('./setup-macos-keychain').registerKeyChain();
}
let version = '';
if (TEST_BUILD || gitTag) {
const jsonVersion = require('../package.json').version;
version = gitTag;
updateVersionNumberIn2rndPackageJson(jsonVersion);
const rootJson = require('../package.json');
update2ndPackageJson(rootJson);
// Add firmware and blhost to extra resources
const extractedFirmwareDir = path.join(__dirname, '../tmp/packages');
extraResources.push({from: extractedFirmwareDir, to: 'packages/'});
builder.build({
dir: DIR,
@@ -98,7 +104,7 @@ if (TEST_BUILD || gitTag) {
author: {
name: 'Ultimate Gadget Laboratories'
},
version: jsonVersion
version: rootJson.version
},
config: {
directories: {
@@ -107,7 +113,8 @@ if (TEST_BUILD || gitTag) {
appId: 'com.ultimategadgetlabs.uhk.agent',
productName: 'UHK Agent',
mac: {
category: 'public.app-category.utilities'
category: 'public.app-category.utilities',
extraResources
},
win: {
extraResources
@@ -133,15 +140,13 @@ if (TEST_BUILD || gitTag) {
else {
console.log('No git tag');
// TODO: Need it?
version = sha.substr(0, 8);
process.exit(1);
}
function updateVersionNumberIn2rndPackageJson(version) {
function update2ndPackageJson(rootJson) {
const jsonPath = path.join(__dirname, '../packages/uhk-agent/dist/package.json');
const json = require(jsonPath);
json.version = version;
json.version = rootJson.version;
jsonfile.writeFileSync(jsonPath, json, {spaces: 2})
}