Browse Source

feat: generate angular project for catalog

pull/34/head
bnymncoskuner 5 years ago
parent
commit
2a77639f63
  1. 31
      apps/angular/angular.json
  2. 24
      apps/angular/projects/catalog/README.md
  3. 44
      apps/angular/projects/catalog/karma.conf.js
  4. 7
      apps/angular/projects/catalog/ng-package.json
  5. 11
      apps/angular/projects/catalog/package.json
  6. 25
      apps/angular/projects/catalog/src/lib/catalog.component.spec.ts
  7. 20
      apps/angular/projects/catalog/src/lib/catalog.component.ts
  8. 16
      apps/angular/projects/catalog/src/lib/catalog.module.ts
  9. 16
      apps/angular/projects/catalog/src/lib/catalog.service.spec.ts
  10. 9
      apps/angular/projects/catalog/src/lib/catalog.service.ts
  11. 7
      apps/angular/projects/catalog/src/public-api.ts
  12. 28
      apps/angular/projects/catalog/src/test.ts
  13. 20
      apps/angular/projects/catalog/tsconfig.lib.json
  14. 10
      apps/angular/projects/catalog/tsconfig.lib.prod.json
  15. 17
      apps/angular/projects/catalog/tsconfig.spec.json
  16. 8
      apps/angular/tsconfig.json

31
apps/angular/angular.json

@ -158,6 +158,37 @@
}
}
}
},
"catalog": {
"projectType": "library",
"root": "projects/catalog",
"sourceRoot": "projects/catalog/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "projects/catalog/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/catalog/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "projects/catalog/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/catalog/src/test.ts",
"tsConfig": "projects/catalog/tsconfig.spec.json",
"karmaConfig": "projects/catalog/karma.conf.js"
}
}
}
}
},
"defaultProject": "EShopOnAbp",

24
apps/angular/projects/catalog/README.md

@ -0,0 +1,24 @@
# Catalog
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.0.
## Code scaffolding
Run `ng generate component component-name --project catalog` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project catalog`.
> Note: Don't forget to add `--project catalog` or else it will be added to the default project in your `angular.json` file.
## Build
Run `ng build catalog` to build the project. The build artifacts will be stored in the `dist/` directory.
## Publishing
After building your library with `ng build catalog`, go to the dist folder `cd dist/catalog` and run `npm publish`.
## Running unit tests
Run `ng test catalog` 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 Overview and Command Reference](https://angular.io/cli) page.

44
apps/angular/projects/catalog/karma.conf.js

@ -0,0 +1,44 @@
// 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'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, '../../coverage/catalog'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

7
apps/angular/projects/catalog/ng-package.json

@ -0,0 +1,7 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/catalog",
"lib": {
"entryFile": "src/public-api.ts"
}
}

11
apps/angular/projects/catalog/package.json

@ -0,0 +1,11 @@
{
"name": "catalog",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^12.2.0",
"@angular/core": "^12.2.0"
},
"dependencies": {
"tslib": "^2.3.0"
}
}

25
apps/angular/projects/catalog/src/lib/catalog.component.spec.ts

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

20
apps/angular/projects/catalog/src/lib/catalog.component.ts

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

16
apps/angular/projects/catalog/src/lib/catalog.module.ts

@ -0,0 +1,16 @@
import { NgModule } from '@angular/core';
import { CatalogComponent } from './catalog.component';
@NgModule({
declarations: [
CatalogComponent
],
imports: [
],
exports: [
CatalogComponent
]
})
export class CatalogModule { }

16
apps/angular/projects/catalog/src/lib/catalog.service.spec.ts

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

9
apps/angular/projects/catalog/src/lib/catalog.service.ts

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

7
apps/angular/projects/catalog/src/public-api.ts

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

28
apps/angular/projects/catalog/src/test.ts

@ -0,0 +1,28 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js';
import 'zone.js/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(),
{ teardown: { destroyAfterEach: true }},
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

20
apps/angular/projects/catalog/tsconfig.lib.json

@ -0,0 +1,20 @@
/* 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"
]
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}

10
apps/angular/projects/catalog/tsconfig.lib.prod.json

@ -0,0 +1,10 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"declarationMap": false
},
"angularCompilerOptions": {
"compilationMode": "partial"
}
}

17
apps/angular/projects/catalog/tsconfig.spec.json

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

8
apps/angular/tsconfig.json

@ -15,7 +15,13 @@
"lib": ["es2018", "dom"],
"paths": {
"@proxy": ["src/app/proxy/index.ts"],
"@proxy/*": ["src/app/proxy/*"]
"@proxy/*": [
"src/app/proxy/*"
],
"catalog": [
"dist/catalog/catalog",
"dist/catalog"
]
}
},
"angularCompilerOptions": {

Loading…
Cancel
Save