Lifecycle manager for node projects
Last updated 2 months ago by groupon .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install nlm 
SYNC missed versions from official npm registry.


A tool for automating the release of libraries in the spirit of semantic-release.


  • Automatically tags pull requests with semver-{patch,minor,major,none} based on the commit history
  • All information is also part of the git history
  • Smart generator that incorporates pull request data
  • Adds license headers for JavaScript and CoffeeScript files

Getting Started


  1. A Github access token with repo scope. This is required for creating version commits, releases, and tagging issues. Github has a instructions for creating an access token.
  2. A valid repository field in your package.json. E.g. or
  3. The repository field should point to an existing project on Github.

Install nlm

  1. Run npm install --save-dev nlm.
  2. Set publishConfig.registry in your package.json if you haven't already.
  3. Set your posttest script in package.json to nlm verify.

Setting up CI

nlm will automatically look for well-known environment variables during CI builds like CI=true, BRANCH=branch-name, etc.. It should work out-of-the-box for both Travis and DotCI.

For Github and npm interactions to work, it requires the following additional environment variables:

  • GH_TOKEN: The access token from above.
  • NPM_TOKEN: An npm access token. You can find this in ~/.npmrc as _authToken.

For registries that don't support _authToken, it's possible to configure NPM_USERNAME, NPM_EMAIL, and NPM_PASSWORD_BASE64 instead. Those values can be found in your ~/.npmrc as username, email, and _password.

All tokens and passwords should be set up as encrypted environment variables.


For Travis you can follow the official Travis docs:

travis encrypt GH_TOKEN=your_github_token --add env

If you want to publish from CI, you can either use the official Travis feature or nlm itself. The latter gives you support for managing different dist-tags based on branches.

If you want to use nlm to publish, you'll have to add NPM_TOKEN:

travis encrypt NPM_TOKEN=your_npm_token --add env


DotCI lacks native support for encrypted environment variables. But the EnvInject Plugin provides an option called "Inject passwords to the build as environment variables" which can fill the same role.

You should also enable builds of pull requests for pushes against the same repository. Otherwise the automated tagging of PRs won't work.

Finally enable publishing by adding the following to .ci.yml:

  <% if (DOTCI_BRANCH == 'master') { %>
    - ./node_modules/.bin/nlm publish
  <% } %>


Most nlm configuration happens via native npm options in package.json:

  • repository: This field is parsed to detect Github API baseUrl and repository name. nlm supports both public Github and Github Enterprise instances. For Github Enterprise, it assumes the API to be at https://<hostname>/api/v3.
  • files: By default nlm will add license headers to everything listed here.

In most cases these settings are enough to make nlm do the right thing. For more customization, you can use .nlmrc or an nlm section in package.json:

  • channels: A map of branch name to npm dist-tag. When publishing, this will determine what will be published and how it's tagged. By default there's one entry in this map: { master: 'latest' }. Which means that a publish from master updates the latest tag and publish from any other branch does nothing.
  • hooks: A map of hook names to shell commands. When executing any of the commands listed below some of these hooks will get triggered. The available hooks are:
Hook Description
prepare Called when the release is about to be prepared. This is before updating files such as package.json, and pushing a commit. It provides a reference to the next version number via the environment variable NLM_NEXT_VERSION.
  • license.files: List of files and/or directories to add license headers to.
  • license.exclude: List of files to exclude that would otherwise be included. nlm will always exclude anything in node_modules.
  • acceptInvalidCommits: Accept commit messages even if they can't be parsed. It's highly discouraged to use this option. In this mode any commit with an invalid commit message will be treated as "semver-major".
  • deprecated: String (may be empty) describing reason this package has been deprecated. To deprecate a package, set it to a descriptive reason. To "un-deprecate" a package, set it to an empty string (can then be later deleted).

If there's no file named LICENSE in the repository, nlm won't attempt to add the headers.


nlm verify

Intended use: posttest script for matrix builds.

Verify that the current state is valid and could be released. Will also add license headers where they are missing.

  1. Add missing license headers.
  2. Verify that the checkout is clean.
  3. Collect change log items and determine what kind of change it is.

nlm release

Intended use: deploy script, or posttest script if not running matrix builds.

Verify that the current state is valid and could be released. Will also add license headers where they are missing.

  1. Everything nlm verify does.
  2. If hooks#prepare is present in the nlm section of the package.json, the shell command defined by the hook will be executed.
  3. If there are unreleased changes:
  4. Create a new CHANGELOG entry and update package.json#version.
  5. Commit and tag the release.
  6. Push the tag and the release branch (e.g. master).
  7. Create a Github release.
  8. Publish the package to npm or update dist-tag if required.

By default nlm release will not do anything unless it's running on CI. You can force a release by running nlm release --commit.

Note: If your current version is below 1.0.0, nlm will always release 1.0.0. The semantics of versions below 1.0.0 can be tricky and nlm tries to not make any assumptions about how people might interpret those version ranges.

nlm changelog

Preview the changelog that would be generated by the commits between the last version tag and the current HEAD. If there are no unreleased commits, the output will be empty.

Current Tags

  • 4.2.0                                ...           latest (2 months ago)

34 Versions

  • 4.2.0                                ...           2 months ago
  • 4.1.1                                ...           2 months ago
  • 4.1.0                                ...           2 months ago
  • 4.0.0                                ...           4 months ago
  • 3.6.3                                ...           4 months ago
  • 3.6.2                                ...           9 months ago
  • 3.6.1                                ...           a year ago
  • 3.6.0                                ...           a year ago
  • 3.5.0                                ...           a year ago
  • 3.4.3                                ...           a year ago
  • 3.4.2                                ...           a year ago
  • 3.4.1                                ...           2 years ago
  • 3.4.0                                ...           2 years ago
  • 3.3.4                                ...           2 years ago
  • 3.3.1                                ...           2 years ago
  • 3.3.0                                ...           3 years ago
  • 3.2.0                                ...           3 years ago
  • 3.1.5                                ...           3 years ago
  • 3.1.4                                ...           3 years ago
  • 3.1.3                                ...           4 years ago
  • 3.1.2                                ...           4 years ago
  • 3.1.1                                ...           4 years ago
  • 3.1.0                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.2.3                                ...           4 years ago
  • 2.2.2                                ...           4 years ago
  • 2.2.1                                ...           4 years ago
  • 2.2.0                                ...           4 years ago
  • 2.1.1                                ...           4 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.2                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
Maintainers (1)
Today 0
This Week 0
This Month 121
Last Day 0
Last Week 36
Last Month 170
Dependencies (9)
Dev Dependencies (9)

Copyright 2014 - 2017 © |