GithubHelp home page GithubHelp logo

nice-registry / npm-buildpack Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 16.0 9 KB

☁️ Heroku Buildpack for npm Authentication

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

Shell 100.00%

npm-buildpack's Introduction

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:

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

Save the token in your Heroku app config:

heroku config:set NPM_AUTH_TOKEN=YOUR_TOKEN_HERE

Configure your app to use this buildpack:

heroku buildpacks:add --index 1 zeke/npm

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:

heroku run bash
cat .npmrc
//registry.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:

heroku config:set NPM_AUTH_TOKEN=NEW_TOKEN
git commit --allow-empty -m "update dat npm token"
git 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:

heroku config:set NPM_CONFIG_PRODUCTION=false

Using the latest source code

The zeke/npm buildpack from the Heroku Buildpack Registry represents the latest stable version of the buildpack. If you'd like to use the source code from this Github repository, you can set your buildpack to the Github URL:

$ heroku buildpacks:set https://github.com/nice-registry/npm-buildpack

npm-buildpack's People

Contributors

jkutner avatar jmorrell avatar zeke avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

npm-buildpack's Issues

Register with Buildpack Registry

My name is Jon Byrum and I’m a product manager at Heroku. Your buildpack is one of the top 200 most popular buildpacks on Heroku!

I would like to invite you to publish your buildpack early in our Buildpack Registry, before it is made available to the general public (expected early July).

To register your buildpack, visit: https://addons-next.heroku.com/buildpacks
Documentation: https://devcenter.heroku.com/articles/buildpack-registry

Why register?

  • By registering early you’ll be able to grab your preferred namespace for the buildpack
  • After registering, your buildpack will be available to all Heroku users when they run heroku buildpacks:search. In the future, we will only display registered buildpacks on elements.heroku.com/buildpacks
  • The Buildpack Registry makes it easy for you to publish a new version of your buildpack, as well as roll back if there are errors

Recommended naming conventions:

  • We recommend that you use the same namespace (e.g., jbyrum) with Buildpack Registry that you use on GitHub
  • In general, avoid using "buildpack" in the name of your registered buildpack
    • For example: If your Github repo is github.com/foobar/heroku-buildpack-elixir, then we recommend a name like "foobar/elixir"

It would be greatly appreciated if you could publish before June 18th, as we prepare to make the feature publicly available. Registering a buildpack should take approximately 5 minutes.

If you have any questions about registering (or run into any issues), please email:
[email protected]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.