bug fixed

This commit is contained in:
richard-loafle
2020-04-09 17:56:38 +09:00
parent d0fe9435d8
commit 3bdd6bac6c
20 changed files with 290 additions and 31 deletions

View 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).

View 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
});
};

View 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"
}
}
}

View 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"
}
}

View File

@@ -0,0 +1,5 @@
import { InjectionToken } from '@angular/core';
export const _MODULE_CONFIG = new InjectionToken(
'@ucap/ng-web-socket config of module'
);

View File

@@ -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();
});
});

View 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);
}
}

View 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]
};
}
}

View File

@@ -0,0 +1,7 @@
/*
* Public API Surface of web-socket
*/
export * from './lib/services/web-socket.service';
export * from './lib/web-storage.module';

View 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);

View 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"]
}

View File

@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.lib.json",
"angularCompilerOptions": {
"enableIvy": false
}
}

View 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"]
}

View File

@@ -0,0 +1,7 @@
{
"extends": "../../tslint.json",
"rules": {
"directive-selector": [true, "attribute", "lib", "camelCase"],
"component-selector": [true, "element", "lib", "kebab-case"]
}
}