nice-registry/npm-buildpack

Name: npm-buildpack

Owner: nice-registry

Description: ?? Heroku Buildpack for npm Authentication

Created: 2016-05-09 04:32:31.0

Updated: 2017-01-21 06:59:01.0

Pushed: 2016-10-03 21:09:10.0

Homepage: http://zeke.sikelianos.com/npm-and-github-automation-with-heroku

Size: 4

Language: Shell

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Heroku Buildpack for npm Authentication

This is a Heroku buildpack that enables authenticated npm operations within a Heroku dyno.

It detects an NPM_AUTH_TOKEN environment variable and creates a .npmrc file.

It is the soul sister of the GitHub Buildpack.

See the blog post: npm and GitHub automation with Heroku

Usage

Use this one-liner to read your npm auth token:

~/.npmrc | head -1 | sed 's/.*=//g'

Save the token in your Heroku app config:

ku config:set GITHUB_AUTH_TOKEN=YOUR_TOKEN_HERE

Configure your app to use this buildpack:

ku buildpacks:add --index 1 https://github.com/zeke/npm-buildpack

The next time you push your app to Heroku, this buildpack will create a .npmrc file containing your npm token in the base directory of the app:

ku run bash
.npmrc
gistry.npmjs.org/:_authToken=00000000-0000-0000-0000-000000000000

Now you can perform authenticated npm operations on the dyno, including npm publish!

Tips

Tip: If you ever change the token, you'll need to redeploy the app to ensure a new .netrc file is created:

ku config:set GITHUB_AUTH_TOKEN=NEW_TOKEN
commit --allow-empty -m "update dat npm token"
push heroku master

Tip: Heroku's node buildpack will install dependencies from package.json by default. If your app needs devDependencies to be installed too, set the following in your app environment:

ku config:set NPM_CONFIG_PRODUCTION=false

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.