Browse Source

lib init

master
dslak 2 years ago
commit
8431ee2081
  1. 24
      README.md
  2. 44
      karma.conf.js
  3. 7
      ng-package.json
  4. 11
      package.json
  5. 23
      src/lib/boss-library.component.spec.ts
  6. 20
      src/lib/boss-library.component.ts
  7. 16
      src/lib/boss-library.module.ts
  8. 16
      src/lib/boss-library.service.spec.ts
  9. 9
      src/lib/boss-library.service.ts
  10. 7
      src/public-api.ts
  11. 27
      src/test.ts
  12. 15
      tsconfig.lib.json
  13. 10
      tsconfig.lib.prod.json
  14. 17
      tsconfig.spec.json

24
README.md

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

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

11
package.json

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

23
src/lib/boss-library.component.spec.ts

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

20
src/lib/boss-library.component.ts

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

16
src/lib/boss-library.module.ts

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

16
src/lib/boss-library.service.spec.ts

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

9
src/lib/boss-library.service.ts

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

7
src/public-api.ts

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

27
src/test.ts

@ -0,0 +1,27 @@
// 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): {
<T>(id: string): T;
keys(): string[];
};
};
// 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().forEach(context);

15
tsconfig.lib.json

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

10
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
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"
]
}
Loading…
Cancel
Save