Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

A guide to publishing a package to NPM using Travis. 


This is a Work in Progress - modifying the pypi docs for NPM

Step-by-step guide

  1. If you're not familiar with how to package a JS module and and share it on NPM, get your bearings by reading their docs.
  2. Modify your repo's Travis configuration so that tagging a release results in a publish to npmjs.
    1. Create a DevOps Support ticket to have DevOps get publish tokens for the edX NPMJS account and have DevOps add it to the travis config using the Travis CI command line client to encrypt the token: 

      1. DEVOPS: Use the edx-semantic-release account and record the token in the Notes with the name of the package. NPM lets us have multiple tokens but doesn't let us label them.

        travis encrypt --add deploy.api_key NPMTOKEN
    2. There are two options here
      1. using the Stages feature of Travis (studio-frontend)
      2. using Travis' simple built-in deploy
        1. Pitfalls: If prefixing your package name with the @edx package scope (which you should!) you'll need to make sure you specify to npm that you still want the package to be public by doing this
    3. Travis documentation on NPM deployment
  3. To publish a new version of your package, update the version, then push a corresponding tag to GitHub.  You can do this using npm version a.b.c  and it will update the version and tags for you
  4. You're done! Don't forget to update webpack files so they download the new package from NPM.

Troubleshooting

If your tag is in GitHub, but is not starting a build in Travis, or if you are deploying from too many sub-builds in Travis, see the following changes to .travis.yml.

  • No labels