fix(usb): user-config-json-to-bin compile

This commit is contained in:
Róbert Kiss
2017-11-02 19:56:21 +01:00
parent 7ab55e9ac5
commit 009dd8e963
3 changed files with 25 additions and 3 deletions

View File

@@ -8,7 +8,8 @@
"build": "tsc" "build": "tsc"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "8.0.28" "@types/node": "8.0.28",
"typescript": "2.5.3"
}, },
"dependencies": { "dependencies": {
"chalk": "2.1.0", "chalk": "2.1.0",

View File

@@ -0,0 +1,21 @@
{
"compileOnSave": false,
"compilerOptions": {
"sourceMap": true,
"declaration": false,
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2016",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2015.iterable",
"es2016",
"dom",
"dom.iterable"
]
}
}

View File

@@ -1,11 +1,11 @@
import { UhkBuffer, UserConfiguration } from '../uhk-common/src/config-serializer/index'; import { UhkBuffer, UserConfiguration } from 'uhk-common';
import * as fs from 'fs'; import * as fs from 'fs';
const inputFile = process.argv[2]; const inputFile = process.argv[2];
console.log(inputFile); console.log(inputFile);
const outputFile = process.argv[3]; const outputFile = process.argv[3];
const config1Js = JSON.parse(fs.readFileSync(inputFile)); const config1Js = JSON.parse(fs.readFileSync(inputFile).toString());
const config1Ts: UserConfiguration = new UserConfiguration().fromJsonObject(config1Js); const config1Ts: UserConfiguration = new UserConfiguration().fromJsonObject(config1Js);
const config1Buffer = new UhkBuffer(); const config1Buffer = new UhkBuffer();
config1Ts.toBinary(config1Buffer); config1Ts.toBinary(config1Buffer);