2.3.0 • Published 2 years ago

evo-shared-resources v2.3.0

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Sample Component Library

Sample project to demo how to share angular component module via NPM

Build and Publish

To package and publish component module, we need to install a packager that will transform this module into a library identifiable as an NPM Package. For that we choose “ng-packagr” which Transpiles your libraries to Angular Package Format. It is an NPM Package built as a wrapper over “Roll-Up” which is a module bundler that compiles code into Libraries and Applications.

  1. Install ng-packagr: npm install ng-packagr --save-dev

  2. Package module as library: npm run packagr

  3. Navigate to 'dist' directory cd dist

  4. Package library for deployment to NPM: npm pack

  5. Login to NPM npm login

  6. Publish to NPM: npm publish

How to consume component/s

Installation npm install evo-shared-resources --save

Importing the Module

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { DkNumberFormatterModule } from 'evo-shared-resources';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
  BrowserModule,
    DkNumberFormatterModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})

export class AppModule { }

Selector <dk-number-formatter [ngNumber]="'1222130'"></dk-number-formatter>