/angular-library-starter

A concise boilerplate for making angular (2+) libraries, with AOT support, type definitions et al.

Primary LanguageJavaScriptMIT LicenseMIT

angular-library-starter

This project is an implementation of Angular Package Format v4.0, so as to build library of components for angular applications. As a consequence, the library can be consumed in various ways, e.g. from apps using Webpack, from apps using SystemJS, from a jsfiddle, a plunkr, etc.

Features

  • Generation to various module formats: FESM15, FESM5, UMD
  • Type definitions
  • Metadata for AOT compilation

Getting started

  1. Clone the library
git clone https://github.com/michaelbazos/angular-library-starter.git
  1. Install dependencies and build the library
cd angular-library-starter
npm install
npm run build
  1. Add the built library as dependency to your application

From your consumer application folder:

npm install ../angular-library-starter/dist --save

Adjust the path to the dist folder accordingly.

Note 1: this installation refers to a local folder. Once you're done you should publish your library to a package manager. Note 2: Argument --save is implicit as of npm5

  1. Import the library in the application
import { MylibModule } from 'mylib';
 
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    ... ,
 
    MylibModule
  ],
  providers: [],
  bootstrap: [ AppComponent ]
})

export class AppModule { }
  1. Use the components
<ui-dropdown></ui-dropdown>

License

MIT © Michael Bazos