bug fixed
This commit is contained in:
24
projects/web-socket/README.md
Normal file
24
projects/web-socket/README.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# WebStorage
|
||||
|
||||
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.0.2.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Run `ng generate component component-name --project web-storage` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project web-storage`.
|
||||
> Note: Don't forget to add `--project web-storage` or else it will be added to the default project in your `angular.json` file.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build web-storage` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||
|
||||
## Publishing
|
||||
|
||||
After building your library with `ng build web-storage`, go to the dist folder `cd dist/web-storage` and run `npm publish`.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `ng test web-storage` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||
|
||||
## Further help
|
||||
|
||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
||||
32
projects/web-socket/karma.conf.js
Normal file
32
projects/web-socket/karma.conf.js
Normal file
@@ -0,0 +1,32 @@
|
||||
// Karma configuration file, see link for more information
|
||||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-jasmine-html-reporter'),
|
||||
require('karma-coverage-istanbul-reporter'),
|
||||
require('@angular-devkit/build-angular/plugins/karma')
|
||||
],
|
||||
client: {
|
||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
coverageIstanbulReporter: {
|
||||
dir: require('path').join(__dirname, '../../coverage/web-storage'),
|
||||
reports: ['html', 'lcovonly', 'text-summary'],
|
||||
fixWebpackSourcePaths: true
|
||||
},
|
||||
reporters: ['progress', 'kjhtml'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome'],
|
||||
singleRun: false,
|
||||
restartOnFileChange: true
|
||||
});
|
||||
};
|
||||
11
projects/web-socket/ng-package.json
Normal file
11
projects/web-socket/ng-package.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
||||
"dest": "../../dist/web-socket",
|
||||
"lib": {
|
||||
"entryFile": "src/public-api.ts",
|
||||
"umdModuleIds": {
|
||||
"@ucap/ng-logger": "@ucap/ng-logger",
|
||||
"@ucap/web-socket": "@ucap/web-socket"
|
||||
}
|
||||
}
|
||||
}
|
||||
13
projects/web-socket/package.json
Normal file
13
projects/web-socket/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "@ucap/ng-web-socket",
|
||||
"version": "0.0.1",
|
||||
"publishConfig": {
|
||||
"registry": "http://10.81.13.221:8081/nexus/repository/npm-ucap/"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/common": "^9.0.2",
|
||||
"@angular/core": "^9.0.2",
|
||||
"@ucap/web-socket": "~0.0.1",
|
||||
"tslib": "^1.10.0"
|
||||
}
|
||||
}
|
||||
5
projects/web-socket/src/lib/config/token.ts
Normal file
5
projects/web-socket/src/lib/config/token.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { InjectionToken } from '@angular/core';
|
||||
|
||||
export const _MODULE_CONFIG = new InjectionToken(
|
||||
'@ucap/ng-web-socket config of module'
|
||||
);
|
||||
@@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { WebSocketService } from './web-socket.service';
|
||||
|
||||
describe('WebSocketService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: WebSocketService = TestBed.inject(WebSocketService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
22
projects/web-socket/src/lib/services/web-socket.service.ts
Normal file
22
projects/web-socket/src/lib/services/web-socket.service.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Injectable, Inject } from '@angular/core';
|
||||
|
||||
import {
|
||||
ModuleConfig,
|
||||
WebSocketService as UCAPWebSocketService
|
||||
} from '@ucap/web-socket';
|
||||
|
||||
import { LogService } from '@ucap/ng-logger';
|
||||
|
||||
import { _MODULE_CONFIG } from '../config/token';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class WebSocketService extends UCAPWebSocketService {
|
||||
constructor(
|
||||
@Inject(_MODULE_CONFIG) moduleConfig: ModuleConfig,
|
||||
logService: LogService
|
||||
) {
|
||||
super(moduleConfig, logService);
|
||||
}
|
||||
}
|
||||
24
projects/web-socket/src/lib/web-storage.module.ts
Normal file
24
projects/web-socket/src/lib/web-storage.module.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { NgModule, ModuleWithProviders } from '@angular/core';
|
||||
|
||||
import { ModuleConfig } from '@ucap/web-storage';
|
||||
|
||||
import { _MODULE_CONFIG } from './config/token';
|
||||
|
||||
import { WebSocketService } from './services/web-socket.service';
|
||||
|
||||
const SERVICES = [WebSocketService];
|
||||
|
||||
@NgModule({})
|
||||
export class WebSocketRootModule {}
|
||||
|
||||
@NgModule({})
|
||||
export class WebSocketModule {
|
||||
public static forRoot(
|
||||
config: ModuleConfig
|
||||
): ModuleWithProviders<WebSocketRootModule> {
|
||||
return {
|
||||
ngModule: WebSocketRootModule,
|
||||
providers: [{ provide: _MODULE_CONFIG, useValue: config }, ...SERVICES]
|
||||
};
|
||||
}
|
||||
}
|
||||
7
projects/web-socket/src/public-api.ts
Normal file
7
projects/web-socket/src/public-api.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
* Public API Surface of web-socket
|
||||
*/
|
||||
|
||||
export * from './lib/services/web-socket.service';
|
||||
|
||||
export * from './lib/web-storage.module';
|
||||
30
projects/web-socket/src/test.ts
Normal file
30
projects/web-socket/src/test.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'zone.js/dist/zone';
|
||||
import 'zone.js/dist/zone-testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
declare const require: {
|
||||
context(
|
||||
path: string,
|
||||
deep?: boolean,
|
||||
filter?: RegExp
|
||||
): {
|
||||
keys(): string[];
|
||||
<T>(id: string): T;
|
||||
};
|
||||
};
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting()
|
||||
);
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
||||
17
projects/web-socket/tsconfig.lib.json
Normal file
17
projects/web-socket/tsconfig.lib.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../out-tsc/lib",
|
||||
"target": "es2015",
|
||||
"declaration": true,
|
||||
"inlineSources": true,
|
||||
"types": [],
|
||||
"lib": ["dom", "es2018"]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"skipTemplateCodegen": true,
|
||||
"strictMetadataEmit": true,
|
||||
"enableResourceInlining": true
|
||||
},
|
||||
"exclude": ["src/test.ts", "**/*.spec.ts"]
|
||||
}
|
||||
6
projects/web-socket/tsconfig.lib.prod.json
Normal file
6
projects/web-socket/tsconfig.lib.prod.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "./tsconfig.lib.json",
|
||||
"angularCompilerOptions": {
|
||||
"enableIvy": false
|
||||
}
|
||||
}
|
||||
9
projects/web-socket/tsconfig.spec.json
Normal file
9
projects/web-socket/tsconfig.spec.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../out-tsc/spec",
|
||||
"types": ["jasmine", "node"]
|
||||
},
|
||||
"files": ["src/test.ts"],
|
||||
"include": ["**/*.spec.ts", "**/*.d.ts"]
|
||||
}
|
||||
7
projects/web-socket/tslint.json
Normal file
7
projects/web-socket/tslint.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "../../tslint.json",
|
||||
"rules": {
|
||||
"directive-selector": [true, "attribute", "lib", "camelCase"],
|
||||
"component-selector": [true, "element", "lib", "kebab-case"]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user