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:
Róbert Kiss
2017-08-19 20:02:17 +02:00
committed by László Monda
parent 97770f67c0
commit 0f558e4132
524 changed files with 25606 additions and 5036 deletions
+3
View File
@@ -0,0 +1,3 @@
export * from './src/util';
export * from './src/models';
export * from './src/services';
+29
View File
@@ -0,0 +1,29 @@
{
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"@angular/core": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/@angular/core/-/core-4.3.3.tgz",
"integrity": "sha1-jmp2kUZh20B/otiN0kQcTAFv9iU=",
"requires": {
"tslib": "1.7.1"
}
},
"@ngrx/core": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@ngrx/core/-/core-1.2.0.tgz",
"integrity": "sha1-iCtGq6+i4ObYh8txobLC+j5tDcY="
},
"@ngrx/store": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@ngrx/store/-/store-2.2.3.tgz",
"integrity": "sha1-570RSfHEQgjxzEdENT8PmKDx9Xs="
},
"tslib": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.7.1.tgz",
"integrity": "sha1-vIAEFkaRkjp5/oN4u+s9ogF1OOw="
}
}
}
+17
View File
@@ -0,0 +1,17 @@
{
"name": "uhk-common",
"private": true,
"version": "1.0.0",
"description": "Common Library contains the common code for uhk-agent (electron-main) and web (electron-renderer) modules",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@angular/core": "^4.3.3",
"@ngrx/core": "1.2.0",
"@ngrx/store": "^2.2.3"
}
}
@@ -0,0 +1,7 @@
import { CommandLineArgs } from './command-line-args';
export interface AppStartInfo {
commandLineArgs: CommandLineArgs;
deviceConnected: boolean;
hasPermission: boolean;
}
@@ -0,0 +1,3 @@
export interface CommandLineArgs {
addons: boolean;
}
+4
View File
@@ -0,0 +1,4 @@
export * from './command-line-args';
export * from './notification';
export * from './ipc-response';
export * from './app-start-info';
@@ -0,0 +1,4 @@
export class IpcResponse {
success: boolean;
error?: { message: string };
}
@@ -0,0 +1,17 @@
import { Action } from '@ngrx/store';
export enum NotificationType {
Default = 'default',
Success = 'success',
Error = 'error',
Warning = 'warning',
Info = 'info',
Undoable = 'undoable'
}
export interface Notification {
type: NotificationType;
title?: string;
message: string;
extra?: Action;
}
@@ -0,0 +1 @@
export * from './logger.service';
@@ -0,0 +1,20 @@
import { Injectable } from '@angular/core';
@Injectable()
export class LogService {
error(...args: any[]): void {
console.error(args);
}
debug(...args: any[]): void {
console.debug(args);
}
silly(...args: any[]): void {
console.debug(args);
}
info(...args: any[]): void {
console.info(args);
}
}
@@ -0,0 +1,5 @@
export namespace Constants {
export const VENDOR_ID = 0x1D50;
export const PRODUCT_ID = 0x6122;
export const MAX_PAYLOAD_SIZE = 64;
}
+39
View File
@@ -0,0 +1,39 @@
export { Constants } from './constants';
export { IpcEvents } from './ipcEvents';
// Source: http://stackoverflow.com/questions/13720256/javascript-regex-camelcase-to-sentence
export function camelCaseToSentence(camelCasedText: string): string {
return camelCasedText.replace(/^[a-z]|[A-Z]/g, function (v, i) {
return i === 0 ? v.toUpperCase() : ' ' + v.toLowerCase();
});
}
export function capitalizeFirstLetter(text: string): string {
return text.charAt(0).toUpperCase() + text.slice(1);
}
/**
* This function coerces a string into a string literal type.
* Using tagged union types in TypeScript 2.0, this enables
* powerful typechecking of our reducers.
*
* Since every action label passes through this function it
* is a good place to ensure all of our action labels
* are unique.
*/
const typeCache: { [label: string]: boolean } = {};
export function type<T>(label: T | ''): T {
if (typeCache[<string>label]) {
throw new Error(`Action type "${label}" is not unique"`);
}
typeCache[<string>label] = true;
return <T>label;
}
export function runInElectron() {
return window && (<any>window).process && (<any>window).process.type;
}
+31
View File
@@ -0,0 +1,31 @@
class App {
public static readonly appStarted = 'app-started';
public static readonly getAppStartInfo = 'app-get-start-info';
public static readonly getAppStartInfoReply = 'app-get-start-info-reply';
}
class AutoUpdate {
public static readonly checkingForUpdate = 'checking-for-update';
public static readonly updateAvailable = 'update-available';
public static readonly updateNotAvailable = 'update-not-available';
public static readonly autoUpdateError = 'auto-update-error';
public static readonly autoUpdateDownloaded = 'update-downloaded';
public static readonly autoUpdateDownloadProgress = 'auto-update-download-progress';
public static readonly updateAndRestart = 'update-and-restart';
public static readonly checkForUpdate = 'check-for-update';
public static readonly checkForUpdateNotAvailable = 'check-for-update-not-available';
}
class Device {
public static readonly setPrivilegeOnLinux = 'set-privilege-on-linux';
public static readonly setPrivilegeOnLinuxReply = 'set-privilege-on-linux-reply';
public static readonly deviceConnectionStateChanged = 'device-connection-state-changed';
public static readonly saveUserConfiguration = 'device-save-user-configuration';
public static readonly saveUserConfigurationReply = 'device-save-user-configuration-reply';
}
export class IpcEvents {
public static readonly app = App;
public static readonly autoUpdater = AutoUpdate;
public static readonly device = Device;
}
+20
View File
@@ -0,0 +1,20 @@
{
"compileOnSave": false,
"compilerOptions": {
"sourceMap": true,
"declaration": false,
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2015.iterable",
"dom",
"es2016"
]
}
}