mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Merged PR 327: Added utils lib to project
Added utils lib to project
This commit is contained in:
120
angular.json
120
angular.json
@@ -816,6 +816,126 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@utils/collection": {
|
||||
"projectType": "library",
|
||||
"root": "apps/utils/collection",
|
||||
"sourceRoot": "apps/utils/collection/src",
|
||||
"prefix": "lib",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:ng-packagr",
|
||||
"options": {
|
||||
"tsConfig": "apps/utils/collection/tsconfig.lib.json",
|
||||
"project": "apps/utils/collection/ng-package.json"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"tsConfig": "apps/utils/collection/tsconfig.lib.prod.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "apps/utils/collection/src/test.ts",
|
||||
"tsConfig": "apps/utils/collection/tsconfig.spec.json",
|
||||
"karmaConfig": "apps/utils/collection/karma.conf.js"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"apps/utils/collection/tsconfig.lib.json",
|
||||
"apps/utils/collection/tsconfig.spec.json"
|
||||
],
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@utils/object": {
|
||||
"projectType": "library",
|
||||
"root": "apps/utils/object",
|
||||
"sourceRoot": "apps/utils/object/src",
|
||||
"prefix": "lib",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:ng-packagr",
|
||||
"options": {
|
||||
"tsConfig": "apps/utils/object/tsconfig.lib.json",
|
||||
"project": "apps/utils/object/ng-package.json"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"tsConfig": "apps/utils/object/tsconfig.lib.prod.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "apps/utils/object/src/test.ts",
|
||||
"tsConfig": "apps/utils/object/tsconfig.spec.json",
|
||||
"karmaConfig": "apps/utils/object/karma.conf.js"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"apps/utils/object/tsconfig.lib.json",
|
||||
"apps/utils/object/tsconfig.spec.json"
|
||||
],
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@utils/common": {
|
||||
"projectType": "library",
|
||||
"root": "apps/utils/common",
|
||||
"sourceRoot": "apps/utils/common/src",
|
||||
"prefix": "lib",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:ng-packagr",
|
||||
"options": {
|
||||
"tsConfig": "apps/utils/common/tsconfig.lib.json",
|
||||
"project": "apps/utils/common/ng-package.json"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"tsConfig": "apps/utils/common/tsconfig.lib.prod.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "apps/utils/common/src/test.ts",
|
||||
"tsConfig": "apps/utils/common/tsconfig.spec.json",
|
||||
"karmaConfig": "apps/utils/common/karma.conf.js"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"apps/utils/common/tsconfig.lib.json",
|
||||
"apps/utils/common/tsconfig.spec.json"
|
||||
],
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultProject": "sales"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { createSelector, createFeatureSelector } from '@ngrx/store';
|
||||
import { Breadcrumb } from '../defs';
|
||||
import { breadcrumbAdapter, BreadcrumbState, featureName } from './breadcrumb.state';
|
||||
import { isArray } from '@utils/common';
|
||||
|
||||
const selectFeature = createFeatureSelector<BreadcrumbState>(featureName);
|
||||
|
||||
@@ -19,9 +20,8 @@ export const selectBreadcrumbsByKey = createSelector(selectAll, (entities, key:
|
||||
/**
|
||||
* Gibt alle Breadcrumb Entities als Array zurück die den key und tag enthalten
|
||||
*/
|
||||
// TODO: Replace Array.isArray with isArray Function from @utils/array
|
||||
export const selectBreadcrumbsByKeyAndTag = createSelector(
|
||||
selectAll,
|
||||
(entities: Breadcrumb[], { key, tag }: { key: string; tag: string }) =>
|
||||
entities.filter((crumb) => crumb.key === key && Array.isArray(crumb.tags) && crumb.tags.includes(tag))
|
||||
entities.filter((crumb) => crumb.key === key && isArray(crumb.tags) && crumb.tags.includes(tag))
|
||||
);
|
||||
|
||||
25
apps/utils/collection/README.md
Normal file
25
apps/utils/collection/README.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Collection
|
||||
|
||||
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.1.2.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Run `ng generate component component-name --project collection` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project collection`.
|
||||
|
||||
> Note: Don't forget to add `--project collection` or else it will be added to the default project in your `angular.json` file.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build collection` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||
|
||||
## Publishing
|
||||
|
||||
After building your library with `ng build collection`, go to the dist folder `cd dist/collection` and run `npm publish`.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `ng test collection` 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
apps/utils/collection/karma.conf.js
Normal file
32
apps/utils/collection/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/utils/collection'),
|
||||
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,
|
||||
});
|
||||
};
|
||||
7
apps/utils/collection/ng-package.json
Normal file
7
apps/utils/collection/ng-package.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
|
||||
"dest": "../../../dist/utils/collection",
|
||||
"lib": {
|
||||
"entryFile": "src/public-api.ts"
|
||||
}
|
||||
}
|
||||
11
apps/utils/collection/package.json
Normal file
11
apps/utils/collection/package.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "@utils/collection",
|
||||
"version": "0.0.1",
|
||||
"peerDependencies": {
|
||||
"@angular/common": "^10.1.2",
|
||||
"@angular/core": "^10.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.0"
|
||||
}
|
||||
}
|
||||
3
apps/utils/collection/src/public-api.ts
Normal file
3
apps/utils/collection/src/public-api.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
/*
|
||||
* Public API Surface of collection
|
||||
*/
|
||||
24
apps/utils/collection/src/test.ts
Normal file
24
apps/utils/collection/src/test.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
// 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);
|
||||
25
apps/utils/collection/tsconfig.lib.json
Normal file
25
apps/utils/collection/tsconfig.lib.json
Normal file
@@ -0,0 +1,25 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../out-tsc/lib",
|
||||
"target": "es2015",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"inlineSources": true,
|
||||
"types": [],
|
||||
"lib": [
|
||||
"dom",
|
||||
"es2018"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"skipTemplateCodegen": true,
|
||||
"strictMetadataEmit": true,
|
||||
"enableResourceInlining": true
|
||||
},
|
||||
"exclude": [
|
||||
"src/test.ts",
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
}
|
||||
10
apps/utils/collection/tsconfig.lib.prod.json
Normal file
10
apps/utils/collection/tsconfig.lib.prod.json
Normal file
@@ -0,0 +1,10 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"declarationMap": false
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableIvy": false
|
||||
}
|
||||
}
|
||||
17
apps/utils/collection/tsconfig.spec.json
Normal file
17
apps/utils/collection/tsconfig.spec.json
Normal file
@@ -0,0 +1,17 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../out-tsc/spec",
|
||||
"types": [
|
||||
"jasmine"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"src/test.ts"
|
||||
],
|
||||
"include": [
|
||||
"**/*.spec.ts",
|
||||
"**/*.d.ts"
|
||||
]
|
||||
}
|
||||
17
apps/utils/collection/tslint.json
Normal file
17
apps/utils/collection/tslint.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"extends": "../../../tslint.json",
|
||||
"rules": {
|
||||
"directive-selector": [
|
||||
true,
|
||||
"attribute",
|
||||
"lib",
|
||||
"camelCase"
|
||||
],
|
||||
"component-selector": [
|
||||
true,
|
||||
"element",
|
||||
"lib",
|
||||
"kebab-case"
|
||||
]
|
||||
}
|
||||
}
|
||||
25
apps/utils/common/README.md
Normal file
25
apps/utils/common/README.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Common
|
||||
|
||||
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.1.2.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Run `ng generate component component-name --project common` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project common`.
|
||||
|
||||
> Note: Don't forget to add `--project common` or else it will be added to the default project in your `angular.json` file.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build common` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||
|
||||
## Publishing
|
||||
|
||||
After building your library with `ng build common`, go to the dist folder `cd dist/common` and run `npm publish`.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `ng test common` 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
apps/utils/common/karma.conf.js
Normal file
32
apps/utils/common/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/utils/common'),
|
||||
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,
|
||||
});
|
||||
};
|
||||
7
apps/utils/common/ng-package.json
Normal file
7
apps/utils/common/ng-package.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
|
||||
"dest": "../../../dist/utils/common",
|
||||
"lib": {
|
||||
"entryFile": "src/public-api.ts"
|
||||
}
|
||||
}
|
||||
11
apps/utils/common/package.json
Normal file
11
apps/utils/common/package.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "@utils/common",
|
||||
"version": "0.0.1",
|
||||
"peerDependencies": {
|
||||
"@angular/common": "^10.1.2",
|
||||
"@angular/core": "^10.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.0"
|
||||
}
|
||||
}
|
||||
5
apps/utils/common/src/lib/index.ts
Normal file
5
apps/utils/common/src/lib/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// start:ng42.barrel
|
||||
export * from './is-array';
|
||||
export * from './is-number';
|
||||
export * from './is-string';
|
||||
// end:ng42.barrel
|
||||
35
apps/utils/common/src/lib/is-array.spec.ts
Normal file
35
apps/utils/common/src/lib/is-array.spec.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { isArray } from './is-array';
|
||||
|
||||
describe('Is Array', () => {
|
||||
it('should return true', () => {
|
||||
expect(isArray([])).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should return false when param is undefined', () => {
|
||||
expect(isArray(undefined)).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should return false when param is null', () => {
|
||||
expect(isArray(null)).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should return false when param is a string', () => {
|
||||
expect(isArray('test')).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should return false when param is a number', () => {
|
||||
expect(isArray(4561)).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should return false when param is an object', () => {
|
||||
expect(isArray({ unit: 'Test' })).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should return false when param is a function', () => {
|
||||
expect(
|
||||
isArray(function hello() {
|
||||
return 'world';
|
||||
})
|
||||
).toBeFalsy();
|
||||
});
|
||||
});
|
||||
3
apps/utils/common/src/lib/is-array.ts
Normal file
3
apps/utils/common/src/lib/is-array.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export function isArray(param: any) {
|
||||
return Array.isArray(param);
|
||||
}
|
||||
27
apps/utils/common/src/lib/is-number.spec.ts
Normal file
27
apps/utils/common/src/lib/is-number.spec.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { isNumber } from './is-number';
|
||||
|
||||
describe('Is Number', () => {
|
||||
it('should return true', () => {
|
||||
expect(isNumber(1)).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should return false when value is NaN and includeNaN is set to false', () => {
|
||||
expect(isNumber(+'test', { includeNaN: false })).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should return true when value is NaN and includeNaN is set to true', () => {
|
||||
expect(isNumber(+'test', { includeNaN: true })).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should return false when value is a string', () => {
|
||||
expect(isNumber('1')).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should return false when value is a Date', () => {
|
||||
expect(isNumber(new Date())).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should return false when value is an Array', () => {
|
||||
expect(isNumber(['1'])).toBeFalsy();
|
||||
});
|
||||
});
|
||||
7
apps/utils/common/src/lib/is-number.ts
Normal file
7
apps/utils/common/src/lib/is-number.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export function isNumber(value: any, { includeNaN }: { includeNaN: boolean } = { includeNaN: false }) {
|
||||
let result = typeof value === 'number';
|
||||
if (result && !includeNaN) {
|
||||
result = !isNaN(value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
27
apps/utils/common/src/lib/is-string.spec.ts
Normal file
27
apps/utils/common/src/lib/is-string.spec.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { isString } from './is-string';
|
||||
|
||||
describe('is String', () => {
|
||||
it('should return true', () => {
|
||||
expect(isString('test')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should return false when value is a number', () => {
|
||||
expect(isString(123)).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should return false when value is a Date', () => {
|
||||
expect(isString(new Date())).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should return false when value is an Array', () => {
|
||||
expect(isString([])).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should return false when value is an Object', () => {
|
||||
expect(isString({})).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should return false when value is a Function', () => {
|
||||
expect(isString(() => {})).toBeFalsy();
|
||||
});
|
||||
});
|
||||
3
apps/utils/common/src/lib/is-string.ts
Normal file
3
apps/utils/common/src/lib/is-string.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export function isString(value: any) {
|
||||
return typeof value === 'string';
|
||||
}
|
||||
4
apps/utils/common/src/public-api.ts
Normal file
4
apps/utils/common/src/public-api.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
/*
|
||||
* Public API Surface of common
|
||||
*/
|
||||
export * from './lib';
|
||||
24
apps/utils/common/src/test.ts
Normal file
24
apps/utils/common/src/test.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
// 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);
|
||||
25
apps/utils/common/tsconfig.lib.json
Normal file
25
apps/utils/common/tsconfig.lib.json
Normal file
@@ -0,0 +1,25 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../out-tsc/lib",
|
||||
"target": "es2015",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"inlineSources": true,
|
||||
"types": [],
|
||||
"lib": [
|
||||
"dom",
|
||||
"es2018"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"skipTemplateCodegen": true,
|
||||
"strictMetadataEmit": true,
|
||||
"enableResourceInlining": true
|
||||
},
|
||||
"exclude": [
|
||||
"src/test.ts",
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
}
|
||||
10
apps/utils/common/tsconfig.lib.prod.json
Normal file
10
apps/utils/common/tsconfig.lib.prod.json
Normal file
@@ -0,0 +1,10 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"declarationMap": false
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableIvy": false
|
||||
}
|
||||
}
|
||||
17
apps/utils/common/tsconfig.spec.json
Normal file
17
apps/utils/common/tsconfig.spec.json
Normal file
@@ -0,0 +1,17 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../out-tsc/spec",
|
||||
"types": [
|
||||
"jasmine"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"src/test.ts"
|
||||
],
|
||||
"include": [
|
||||
"**/*.spec.ts",
|
||||
"**/*.d.ts"
|
||||
]
|
||||
}
|
||||
17
apps/utils/common/tslint.json
Normal file
17
apps/utils/common/tslint.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"extends": "../../../tslint.json",
|
||||
"rules": {
|
||||
"directive-selector": [
|
||||
true,
|
||||
"attribute",
|
||||
"lib",
|
||||
"camelCase"
|
||||
],
|
||||
"component-selector": [
|
||||
true,
|
||||
"element",
|
||||
"lib",
|
||||
"kebab-case"
|
||||
]
|
||||
}
|
||||
}
|
||||
25
apps/utils/object/README.md
Normal file
25
apps/utils/object/README.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Object
|
||||
|
||||
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.1.2.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Run `ng generate component component-name --project object` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project object`.
|
||||
|
||||
> Note: Don't forget to add `--project object` or else it will be added to the default project in your `angular.json` file.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build object` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||
|
||||
## Publishing
|
||||
|
||||
After building your library with `ng build object`, go to the dist folder `cd dist/object` and run `npm publish`.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `ng test object` 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
apps/utils/object/karma.conf.js
Normal file
32
apps/utils/object/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/utils/object'),
|
||||
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,
|
||||
});
|
||||
};
|
||||
7
apps/utils/object/ng-package.json
Normal file
7
apps/utils/object/ng-package.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
|
||||
"dest": "../../../dist/utils/object",
|
||||
"lib": {
|
||||
"entryFile": "src/public-api.ts"
|
||||
}
|
||||
}
|
||||
11
apps/utils/object/package.json
Normal file
11
apps/utils/object/package.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "@utils/object",
|
||||
"version": "0.0.1",
|
||||
"peerDependencies": {
|
||||
"@angular/common": "^10.1.2",
|
||||
"@angular/core": "^10.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.0"
|
||||
}
|
||||
}
|
||||
3
apps/utils/object/src/public-api.ts
Normal file
3
apps/utils/object/src/public-api.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
/*
|
||||
* Public API Surface of object
|
||||
*/
|
||||
24
apps/utils/object/src/test.ts
Normal file
24
apps/utils/object/src/test.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
// 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);
|
||||
25
apps/utils/object/tsconfig.lib.json
Normal file
25
apps/utils/object/tsconfig.lib.json
Normal file
@@ -0,0 +1,25 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../out-tsc/lib",
|
||||
"target": "es2015",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"inlineSources": true,
|
||||
"types": [],
|
||||
"lib": [
|
||||
"dom",
|
||||
"es2018"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"skipTemplateCodegen": true,
|
||||
"strictMetadataEmit": true,
|
||||
"enableResourceInlining": true
|
||||
},
|
||||
"exclude": [
|
||||
"src/test.ts",
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
}
|
||||
10
apps/utils/object/tsconfig.lib.prod.json
Normal file
10
apps/utils/object/tsconfig.lib.prod.json
Normal file
@@ -0,0 +1,10 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"declarationMap": false
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableIvy": false
|
||||
}
|
||||
}
|
||||
17
apps/utils/object/tsconfig.spec.json
Normal file
17
apps/utils/object/tsconfig.spec.json
Normal file
@@ -0,0 +1,17 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../out-tsc/spec",
|
||||
"types": [
|
||||
"jasmine"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"src/test.ts"
|
||||
],
|
||||
"include": [
|
||||
"**/*.spec.ts",
|
||||
"**/*.d.ts"
|
||||
]
|
||||
}
|
||||
17
apps/utils/object/tslint.json
Normal file
17
apps/utils/object/tslint.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"extends": "../../../tslint.json",
|
||||
"rules": {
|
||||
"directive-selector": [
|
||||
true,
|
||||
"attribute",
|
||||
"lib",
|
||||
"camelCase"
|
||||
],
|
||||
"component-selector": [
|
||||
true,
|
||||
"element",
|
||||
"lib",
|
||||
"kebab-case"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -93,11 +93,19 @@
|
||||
"apps/domain/checkout/src/public-api.ts"
|
||||
],
|
||||
"@ui/icon": [
|
||||
"apps/ui/icon/src/lib/public-api.ts"
|
||||
"apps/ui/icon/src/public-api.ts"
|
||||
],
|
||||
"@core/breadcrumb": [
|
||||
"dist/core/breadcrumb/core-breadcrumb",
|
||||
"dist/core/breadcrumb"
|
||||
"apps/core/breadcrumb/src/public-api.ts"
|
||||
],
|
||||
"@utils/collection": [
|
||||
"apps/utils/collection/src/public-api.ts"
|
||||
],
|
||||
"@utils/object": [
|
||||
"apps/utils/object/src/public-api.ts"
|
||||
],
|
||||
"@utils/common": [
|
||||
"apps/utils/common/src/public-api.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user