build: user-config-json-to-bin.ts runnable from other directory (#489)
* new setup * make run able ts file from other directory * do not build project
This commit is contained in:
committed by
László Monda
parent
8660a9ae50
commit
78e27c3688
@@ -4,8 +4,15 @@
|
|||||||
"description": "Agent USB scripts",
|
"description": "Agent USB scripts",
|
||||||
"main": "uhk.js",
|
"main": "uhk.js",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
"scripts": {
|
||||||
|
"build": "npm run chmod",
|
||||||
|
"tsc": "tsc",
|
||||||
|
"chmod": "shx chmod u+x ./*.ts",
|
||||||
|
"watch": "tsc -w"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "8.0.28",
|
"@types/node": "8.0.28",
|
||||||
|
"shx": "0.2.2",
|
||||||
"typescript": "2.5.3"
|
"typescript": "2.5.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"target": "es2016",
|
"target": "es2016",
|
||||||
"outDir": "./dist",
|
|
||||||
"typeRoots": [
|
"typeRoots": [
|
||||||
"node_modules/@types"
|
"node_modules/@types"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
#!/usr/bin/env ts-node
|
#!/usr/bin/env ts-node
|
||||||
|
///<reference path="./node_modules/@types/node/index.d.ts"/>
|
||||||
|
|
||||||
import { UhkBuffer, UserConfiguration } from 'uhk-common';
|
import { UhkBuffer, UserConfiguration } from 'uhk-common';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
const outputFile = process.argv[2];
|
const outputFile = process.argv[2];
|
||||||
const inputFile = `${__dirname}/../uhk-web/src/app/services/user-config.json`;
|
const inputFile = path.join(__dirname, '/../uhk-web/src/app/services/user-config.json');
|
||||||
const config1Js = JSON.parse(fs.readFileSync(inputFile).toString());
|
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();
|
||||||
|
|||||||
Reference in New Issue
Block a user