Bundle utils libs in one lib as submodules

This commit is contained in:
Lorenz Hilpert
2023-01-31 14:25:54 +01:00
parent 55d7687561
commit cc6f70e834
37 changed files with 174 additions and 522 deletions

View File

@@ -375,99 +375,6 @@
}
}
},
"@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": {
"tsConfig": "apps/utils/collection/tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"polyfills": [
"zone.js",
"zone.js/testing"
]
}
}
}
},
"@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": {
"tsConfig": "apps/utils/object/tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"polyfills": [
"zone.js",
"zone.js/testing"
]
}
}
}
},
"@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": {
"tsConfig": "apps/utils/common/tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"polyfills": [
"zone.js",
"zone.js/testing"
]
}
}
}
},
"@shell/breadcrumb": {
"projectType": "library",
"root": "apps/shell/breadcrumb",
@@ -499,37 +406,6 @@
}
}
},
"@utils/id": {
"projectType": "library",
"root": "apps/utils/id",
"sourceRoot": "apps/utils/id/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "apps/utils/id/tsconfig.lib.json",
"project": "apps/utils/id/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "apps/utils/id/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"tsConfig": "apps/utils/id/tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"polyfills": [
"zone.js",
"zone.js/testing"
]
}
}
}
},
"@domain/defs": {
"projectType": "library",
"root": "apps/domain/defs",
@@ -1656,6 +1532,40 @@
}
}
}
},
"utils": {
"projectType": "library",
"root": "apps/utils",
"sourceRoot": "apps/utils",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "apps/utils/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "apps/utils/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "apps/utils/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"tsConfig": "apps/utils/tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"polyfills": [
"zone.js",
"zone.js/testing"
]
}
}
}
}
}
}

25
apps/utils/README.md Normal file
View File

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

View File

@@ -1,25 +0,0 @@
# 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).

View File

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

View File

@@ -1,24 +0,0 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "../../../out-tsc/lib",
"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

@@ -1,14 +0,0 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "../../../out-tsc/spec",
"types": [
"jasmine"
]
},
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

View File

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

View File

@@ -1,25 +0,0 @@
# 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).

View File

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

View File

@@ -1,24 +0,0 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "../../../out-tsc/lib",
"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

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

View File

@@ -1,14 +0,0 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "../../../out-tsc/spec",
"types": [
"jasmine"
]
},
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

View File

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

View File

@@ -1,25 +0,0 @@
# Id
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 id` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project id`.
> Note: Don't forget to add `--project id` or else it will be added to the default project in your `angular.json` file.
## Build
Run `ng build id` to build the project. The build artifacts will be stored in the `dist/` directory.
## Publishing
After building your library with `ng build id`, go to the dist folder `cd dist/id` and run `npm publish`.
## Running unit tests
Run `ng test id` 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

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

View File

@@ -1,24 +0,0 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "../../../out-tsc/lib",
"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

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

View File

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

View File

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

View File

@@ -1,25 +0,0 @@
# 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).

View File

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

View File

@@ -1,24 +0,0 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "../../../out-tsc/lib",
"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

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

View File

@@ -1,14 +0,0 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "../../../out-tsc/spec",
"types": [
"jasmine"
]
},
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

View File

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

11
apps/utils/package.json Normal file
View File

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

View File

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

View File

@@ -0,0 +1,12 @@
import { Component } from '@angular/core';
@Component({
selector: 'lib-utils',
template: `
<p>
utils works!
</p>
`,
styles: [],
})
export class UtilsComponent {}

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,14 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": []
},
"exclude": [
"**/*.spec.ts"
]
}

View File

@@ -1,8 +1,8 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../../tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../../out-tsc/spec",
"outDir": "../../out-tsc/spec",
"types": [
"jasmine"
]
@@ -11,4 +11,4 @@
"**/*.spec.ts",
"**/*.d.ts"
]
}
}

View File

@@ -39,10 +39,7 @@
"test:shell-process": "ng test @shell/process",
"test:store-search-component-store": "ng test @store/search-component-store",
"test:ui": "ng test ui",
"*test:utils-collection": "ng test @utils/collection",
"test:utils-common": "ng test @utils/common",
"*test:utils-id": "ng test @utils/id",
"*test:utils-object": "ng test @utils/object",
"*test:utils": "ng test utils",
"*test:native-container": "ng test native-container",
"lint": "ng lint",
"e2e": "ng e2e",

View File

@@ -153,17 +153,8 @@
"@ui/*": [
"apps/ui/*/src/public-api.ts"
],
"@utils/collection": [
"apps/utils/collection/src/public-api.ts"
],
"@utils/common": [
"apps/utils/common/src/public-api.ts"
],
"@utils/id": [
"apps/utils/id/src/public-api.ts"
],
"@utils/object": [
"apps/utils/object/src/public-api.ts"
"@utils/*": [
"apps/utils/*/src/public-api.ts"
],
"core": [
"dist/core"
@@ -179,6 +170,9 @@
],
"ui": [
"dist/ui"
],
"utils": [
"dist/utils"
]
},
"useDefineForClassFields": false