Utilize ts-node to run user-config-json-to-bin.ts. Remove the lint pre-commit hook because I couldn't commit with git.
This commit is contained in:
11
packages/usb/user-config-json-to-bin.ts
Normal file → Executable file
11
packages/usb/user-config-json-to-bin.ts
Normal file → Executable file
@@ -1,15 +1,12 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
#!/usr/bin/env ts-node
|
||||
import { UhkBuffer, UserConfiguration } from 'uhk-common';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const inputFile = process.argv[2];
|
||||
console.log(inputFile);
|
||||
const outputFile = process.argv[3];
|
||||
|
||||
const outputFile = process.argv[2];
|
||||
const inputFile = `${__dirname}/../uhk-web/src/app/services/user-config.json`;
|
||||
const config1Js = JSON.parse(fs.readFileSync(inputFile).toString());
|
||||
const config1Ts: UserConfiguration = new UserConfiguration().fromJsonObject(config1Js);
|
||||
const config1Buffer = new UhkBuffer();
|
||||
config1Ts.toBinary(config1Buffer);
|
||||
const config1BufferContent = config1Buffer.getBufferContent();
|
||||
fs.writeFileSync('user-config.bin', config1BufferContent);
|
||||
fs.writeFileSync(outputFile, config1BufferContent);
|
||||
|
||||
Reference in New Issue
Block a user