Skip to content

Commit

Permalink
feat(view): init module
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Apr 19, 2020
1 parent 242f76a commit d3d74bf
Show file tree
Hide file tree
Showing 17 changed files with 295 additions and 1 deletion.
40 changes: 40 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,46 @@
}
}
}
},
"ledge-view": {
"projectType": "library",
"root": "projects/ledge-view",
"sourceRoot": "projects/ledge-view/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/ledge-view/tsconfig.lib.json",
"project": "projects/ledge-view/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/ledge-view/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/ledge-view/src/test.ts",
"tsConfig": "projects/ledge-view/tsconfig.spec.json",
"karmaConfig": "projects/ledge-view/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/ledge-view/tsconfig.lib.json",
"projects/ledge-view/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "ledge",
Expand Down
25 changes: 25 additions & 0 deletions projects/ledge-view/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# LedgeView

This library was generated with [Angular CLI](https:/angular/angular-cli) version 9.0.5.

## Code scaffolding

Run `ng generate component component-name --project ledge-view` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ledge-view`.

> Note: Don't forget to add `--project ledge-view` or else it will be added to the default project in your `angular.json` file.
## Build

Run `ng build ledge-view` to build the project. The build artifacts will be stored in the `dist/` directory.

## Publishing

After building your library with `ng build ledge-view`, go to the dist folder `cd dist/ledge-view` and run `npm publish`.

## Running unit tests

Run `ng test ledge-view` 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:/angular/angular-cli/blob/master/README.md).
32 changes: 32 additions & 0 deletions projects/ledge-view/karma.conf.js
Original file line number Diff line number Diff line change
@@ -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/ledge-view'),
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 changes: 7 additions & 0 deletions projects/ledge-view/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/ledge-view",
"lib": {
"entryFile": "src/public-api.ts"
}
}
9 changes: 9 additions & 0 deletions projects/ledge-view/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "ledge-view",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^9.0.5",
"@angular/core": "^9.0.5",
"tslib": "^1.10.0"
}
}
25 changes: 25 additions & 0 deletions projects/ledge-view/src/lib/ledge-view.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { LedgeViewComponent } from './ledge-view.component';

describe('LedgeViewComponent', () => {
let component: LedgeViewComponent;
let fixture: ComponentFixture<LedgeViewComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LedgeViewComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(LedgeViewComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
19 changes: 19 additions & 0 deletions projects/ledge-view/src/lib/ledge-view.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'lib-ledge-view',
template: `
<p>
ledge-view works!
</p>
`,
styles: []
})
export class LedgeViewComponent implements OnInit {

constructor() { }

ngOnInit(): void {
}

}
12 changes: 12 additions & 0 deletions projects/ledge-view/src/lib/ledge-view.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { NgModule } from '@angular/core';
import { LedgeViewComponent } from './ledge-view.component';



@NgModule({
declarations: [LedgeViewComponent],
imports: [
],
exports: [LedgeViewComponent]
})
export class LedgeViewModule { }
16 changes: 16 additions & 0 deletions projects/ledge-view/src/lib/ledge-view.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';

import { LedgeViewService } from './ledge-view.service';

describe('LedgeViewService', () => {
let service: LedgeViewService;

beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(LedgeViewService);
});

it('should be created', () => {
expect(service).toBeTruthy();
});
});
9 changes: 9 additions & 0 deletions projects/ledge-view/src/lib/ledge-view.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Injectable } from '@angular/core';

@Injectable({
providedIn: 'root'
})
export class LedgeViewService {

constructor() { }
}
7 changes: 7 additions & 0 deletions projects/ledge-view/src/public-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Public API Surface of ledge-view
*/

export * from './lib/ledge-view.service';
export * from './lib/ledge-view.component';
export * from './lib/ledge-view.module';
26 changes: 26 additions & 0 deletions projects/ledge-view/src/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 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);
23 changes: 23 additions & 0 deletions projects/ledge-view/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"declaration": true,
"inlineSources": true,
"types": [],
"lib": [
"dom",
"es2018"
]
},
"angularCompilerOptions": {
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"enableResourceInlining": true
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}
6 changes: 6 additions & 0 deletions projects/ledge-view/tsconfig.lib.prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.lib.json",
"angularCompilerOptions": {
"enableIvy": false
}
}
17 changes: 17 additions & 0 deletions projects/ledge-view/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"src/test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}
17 changes: 17 additions & 0 deletions projects/ledge-view/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "../../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"lib",
"camelCase"
],
"component-selector": [
true,
"element",
"lib",
"kebab-case"
]
}
}
6 changes: 5 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@
"ledge-render": [
"dist/ledge-render/ledge-render",
"dist/ledge-render"
],
"ledge-view": [
"dist/ledge-view/ledge-view",
"dist/ledge-view"
]
}
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}
}

0 comments on commit d3d74bf

Please sign in to comment.