refactore: create feature modules (#387)
* add @angular/cli to the project * increase nodejs version -> 8.2.1 * add lerna * merge web and shared module * move electron module into packages as uhk-agent Electron agent functionality is not working * delete symlinker * convert private properties to public of component if used in html * revert uhk-message.component * fix component path * fix the correct name of the uhk-message.component.scss * building web and electron module * delete uhk-renderer package * handle device connect disconnect state * add privilege detection * fix set privilege functionality * turn back download keymap functionality * add bootstrap, select2 js and fix null pointer exception * turn back upload data to keyboard * fix send keymap * fix test-serializer * add missing package.json * merging * fix appveyor build * fix linting * turn back electron storage service * commit the missing electron-datastorage-repository * update node to 8.3.0 in .nvmrc and log node version in appveyor build * set exact version number in appveyor build * vertical align privilege and missing device components * set back node version to 8 in appveyor * move node-usb dependency from usb dir to root maybe it is fix the appveyor build * revert usb to root * fix electron builder script * fix electron builder script * turn off electron devtools * remove CTRL+U functionality * fix CTRL+o * fix lint error * turnoff store freeze * start process when got `Error: EPERM: operation not permitted` error * move files from root usb dir -> packages/usb
This commit is contained in:
committed by
László Monda
parent
97770f67c0
commit
0f558e4132
4
packages/test-serializer/.gitignore
vendored
Normal file
4
packages/test-serializer/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
uhk-config.bin
|
||||
uhk-config-serialized.json
|
||||
uhk-config-serialized.bin
|
||||
test-serializer.js
|
||||
25
packages/test-serializer/package.json
Normal file
25
packages/test-serializer/package.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "test-serializer",
|
||||
"main": "test-serializer.js",
|
||||
"version": "0.0.0",
|
||||
"description": "Agent is the configuration application of the Ultimate Hacking Keyboard.",
|
||||
"author": "Ultimate Gadget Laboratories",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:UltimateHackingKeyboard/agent.git"
|
||||
},
|
||||
"license": "GPL-3.0",
|
||||
"engines": {
|
||||
"node": ">=8.1.0 <9.0.0",
|
||||
"npm": ">=5.1.0 <6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
},
|
||||
"devDependencies": {
|
||||
"uhk-web": "^1.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "webpack",
|
||||
"test": "node ./test-serializer.js"
|
||||
}
|
||||
}
|
||||
45
packages/test-serializer/test-serializer.ts
Normal file
45
packages/test-serializer/test-serializer.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { UserConfiguration } from '../uhk-web/src/app/config-serializer/config-items/user-configuration';
|
||||
import { UhkBuffer } from '../uhk-web/src/app/config-serializer/uhk-buffer';
|
||||
|
||||
const assert = require('assert');
|
||||
const fs = require('fs');
|
||||
|
||||
const userConfig = JSON.parse(fs.readFileSync('../uhk-web/src/app/config-serializer/user-config.json'));
|
||||
|
||||
const config1Js = userConfig;
|
||||
const config1Ts: UserConfiguration = new UserConfiguration().fromJsonObject(config1Js);
|
||||
const config1Buffer = new UhkBuffer();
|
||||
config1Ts.toBinary(config1Buffer);
|
||||
const config1BufferContent = config1Buffer.getBufferContent();
|
||||
fs.writeFileSync('user-config.bin', config1BufferContent);
|
||||
|
||||
config1Buffer.offset = 0;
|
||||
console.log();
|
||||
const config2Ts = new UserConfiguration().fromBinary(config1Buffer);
|
||||
console.log('\n');
|
||||
const config2Js = config2Ts.toJsonObject();
|
||||
const config2Buffer = new UhkBuffer();
|
||||
config2Ts.toBinary(config2Buffer);
|
||||
fs.writeFileSync('user-config-serialized.json', JSON.stringify(config2Js, undefined, 4));
|
||||
const config2BufferContent = config1Buffer.getBufferContent();
|
||||
fs.writeFileSync('user-config-serialized.bin', config2BufferContent);
|
||||
|
||||
console.log('\n');
|
||||
let returnValue = 0;
|
||||
try {
|
||||
assert.deepEqual(config1Js, config2Js);
|
||||
console.log('JSON configurations are identical.');
|
||||
} catch (error) {
|
||||
console.log('JSON configurations differ.');
|
||||
returnValue = 1;
|
||||
}
|
||||
|
||||
const buffersContentsAreEqual: boolean = Buffer.compare(config1BufferContent, config2BufferContent) === 0;
|
||||
if (buffersContentsAreEqual) {
|
||||
console.log('Binary configurations are identical.');
|
||||
} else {
|
||||
console.log('Binary configurations differ.');
|
||||
returnValue += 2;
|
||||
}
|
||||
|
||||
process.exit(returnValue);
|
||||
14
packages/test-serializer/tsconfig.json
Normal file
14
packages/test-serializer/tsconfig.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"experimentalDecorators": true,
|
||||
"typeRoots": [
|
||||
"../node_modules/@types"
|
||||
],
|
||||
"types": [
|
||||
"node"
|
||||
]
|
||||
}
|
||||
}
|
||||
BIN
packages/test-serializer/user-config-serialized.bin
Normal file
BIN
packages/test-serializer/user-config-serialized.bin
Normal file
Binary file not shown.
1550
packages/test-serializer/user-config-serialized.json
Normal file
1550
packages/test-serializer/user-config-serialized.json
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/test-serializer/user-config.bin
Normal file
BIN
packages/test-serializer/user-config.bin
Normal file
Binary file not shown.
28
packages/test-serializer/webpack.config.js
Normal file
28
packages/test-serializer/webpack.config.js
Normal file
@@ -0,0 +1,28 @@
|
||||
// var webpack = require("webpack");
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
main: __dirname + '/test-serializer.ts'
|
||||
},
|
||||
target: 'node',
|
||||
output: {
|
||||
path: __dirname,
|
||||
filename: "test-serializer.js"
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.webpack.js', '.web.js', '.ts', '.js'],
|
||||
modules: ['node_modules']
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{ test: /\.ts$/, loader: 'ts-loader', exclude: /node_modules/ }
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
// new webpack.optimize.UglifyJsPlugin({ minimize: true }),
|
||||
],
|
||||
node: {
|
||||
fs: "empty"
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user