Added @cdn/product-image library

This commit is contained in:
Lorenz Hilpert
2021-02-23 14:19:46 +01:00
parent 7a788b64c3
commit 237c36a3b1
19 changed files with 485 additions and 194 deletions

View File

@@ -1816,6 +1816,46 @@
}
}
}
},
"@cdn/product-image": {
"projectType": "library",
"root": "apps/cdn/product-image",
"sourceRoot": "apps/cdn/product-image/src",
"prefix": "cdn",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "apps/cdn/product-image/tsconfig.lib.json",
"project": "apps/cdn/product-image/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "apps/cdn/product-image/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "apps/cdn/product-image/src/test.ts",
"tsConfig": "apps/cdn/product-image/tsconfig.spec.json",
"karmaConfig": "apps/cdn/product-image/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"apps/cdn/product-image/tsconfig.lib.json",
"apps/cdn/product-image/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "sales"

View File

@@ -0,0 +1,25 @@
# ProductImage
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 product-image` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project product-image`.
> Note: Don't forget to add `--project product-image` or else it will be added to the default project in your `angular.json` file.
## Build
Run `ng build product-image` to build the project. The build artifacts will be stored in the `dist/` directory.
## Publishing
After building your library with `ng build product-image`, go to the dist folder `cd dist/product-image` and run `npm publish`.
## Running unit tests
Run `ng test product-image` 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/cdn/product-image'),
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,7 @@
{
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../../dist/cdn/product-image",
"lib": {
"entryFile": "src/public-api.ts"
}
}

View File

@@ -0,0 +1,11 @@
{
"name": "@cdn/product-image",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^10.1.2",
"@angular/core": "^10.1.2"
},
"dependencies": {
"tslib": "^2.0.0"
}
}

View File

@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ProductImageComponent } from './product-image.component';
describe('ProductImageComponent', () => {
let component: ProductImageComponent;
let fixture: ComponentFixture<ProductImageComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ProductImageComponent],
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ProductImageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,16 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'cdn-product-image',
template: `
<p>
product-image works!
</p>
`,
styles: [],
})
export class ProductImageComponent implements OnInit {
constructor() {}
ngOnInit(): void {}
}

View File

@@ -0,0 +1,9 @@
import { NgModule } from '@angular/core';
import { ProductImageComponent } from './product-image.component';
@NgModule({
declarations: [ProductImageComponent],
imports: [],
exports: [ProductImageComponent],
})
export class ProductImageModule {}

View File

@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { ProductImageService } from './product-image.service';
describe('ProductImageService', () => {
let service: ProductImageService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ProductImageService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@@ -0,0 +1,8 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root',
})
export class ProductImageService {
constructor() {}
}

View File

@@ -0,0 +1,7 @@
/*
* Public API Surface of product-image
*/
export * from './lib/product-image.service';
export * from './lib/product-image.component';
export * from './lib/product-image.module';

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

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

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

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

View File

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

View File

@@ -25,7 +25,7 @@
<h5 class="option-name">{{ option$ | async }}</h5>
<hr />
<div class="product-row">
<img class="thumbnail" src="https://produktbilder-test.paragon-data.net/9783551354013.jpg?showDummy=true" />
<img class="thumbnail" src=" https://produktbilder-test.paragon-data.net/9783551354013.jpg?showDummy=true" />
<div class="details">
<h6 class="title">{{ item?.product?.contributors }} - {{ item?.product?.name }}</h6>
<strong class="can-add-error" *ngIf="canAddError$ | async; let canAddError">{{ canAddError }}</strong>

386
package-lock.json generated
View File

File diff suppressed because it is too large Load Diff

View File

@@ -172,6 +172,9 @@
],
"@domain/availability": [
"apps/domain/availability/src/public-api.ts"
],
"@cdn/product-image": [
"apps/cdn/product-image/cdn-product-image/src/public-api.ts"
]
}
}