How to Write a Library for Angular 2

NG-NL

2016

<project-overview>

  • [framework]="Angular 2"
     
  • [language]="TypeScript"
     
  • [tests]="Karma & Jasmine"
     
  • [builder]="npm"

<project-setup>

<project-setup>

  • init Github
     
  • init npm
     
  • install dependencies

<code>

<code>

  • write your lib
     
  • create the main file with exports

<compile>

<compile>

  • install the TypeScript compiler
     
  • add a prepublish script
     
  • add the typings (ng2 beta 6)
     
  • add a tsconfig.json file

<test>

<test>

  • install karma
     
  • add the karma shim for Angular 2
     
  • write some tests
     
  • use npm link

<distribute>

<distribute>

  • add a .gitignore file
     
  • add a .npmignore file
     
  • publish
     
  • conquer the world

ng2-translate on Github & npm

Publish an Angular 2 library & win an ebook of:
Become a Ninja with Angular 2 - by Ninja Squad

How to write an Angular 2 library

By Olivier Combe

How to write an Angular 2 library

  • 4,507