Skip to content

Latest commit

 

History

History
91 lines (65 loc) · 3.35 KB

README.md

File metadata and controls

91 lines (65 loc) · 3.35 KB

Ng2 library generator

Generator for Angular2+ libraries

Commitizen friendly semantic-release Build Status

Table of Contents

Introduction

This generator is optimized for creating Angular >= 4.0.0 libraries.

This project has been created following the best practices and guidelines from Angular.io and the Packaging Angular talk from Jason Aden.

NPM Deployment

Login into your project's NPM registry. If you don't have an account yet, sign up here

npm login

Setup Semantic-release-cli

Semantic-release-cli provides you with a fully automated package publishing. Read more about the Semantic-release-cli here.

Install the npm package globally on your machine

npm install -g semantic-release-cli

then, navigate inside your library root folder and run:

semantic-release-cli setup

And answer the questions required for the installation process just make sure to answer No to the last one as we already have a .travis.yml configuration file.

? What is your npm registry? https://registry.npmjs.org/
? What is your npm username? your username
? What is your GitHub username? your username
? What is your GitHub two-factor authentication code? xxxxxxx
? What CI are you using? Travis CI
? Do you want a `.travis.yml` file with semantic-release setup? No
# Important to select No to avoid overwriting the already exisisting `.travis.yml` file.

Crypt your credentials

DEPRECATED

Generate a authentication token crypting your npm credentials with the following command:

echo -n 'username:password' | openssl base64

This will output a key like this: dXNlcm5hbWU6cGFzc3dvcmQ=

TravisCI configuration

DEPRECATED

Reach your TravisCI project settings and add a new environment variable called NPM_TOKEN with the token previously generated. Then create another environment variable in TravisCI called NPM_EMAIL and set it to the npm user email address linked to your previous login credentials used for generating the token.

Then the deployment script stored in the scripts/deploy.sh will be responsable for automatically deploy your library to NPM every time a new version is present in the package.json file.

Deployment lifecycle

  1. Create your new code change in your local directory
  2. Commit your changes using Commitizen with npm run commit
  3. Release a new npm version using semantic versioning with npm version patch | minor | major
  4. Push your changes
  5. Wait for Travis to publish your new version