Skip to content
Peter Rasmussen edited this page Jul 28, 2022 · 1 revision

Welcome to the amat-react wiki!

How to publish NPM packages

IMPORTANT: Use yarn for everything. Or, if you must, use npm for everything. Do not mix and match commands. They seem to work in different spaces, and won't know where each others' packages are linked.

How to publish an official package

  1. Update your project's version number in the package.json file
  2. Build your project
  3. Publish your project with the command yarn publish

It really is that easy. If you run into permissions issues, contact me (Kim Thompson) or someone else on the web team, and we can get you added to the @apmg group

How to publish a beta package

Let's say you're not quite ready for the world to see this package yet, but you want to see it in action. Here's how you make a beta build.

  1. Update your project's version number in the package.json file, then add the text -beta.0 to the end. This means that if the final version of your change will be under 1.3.3, you'd name this package 1.3.3-beta.0. Increment that final "0" if you end up publishing more betas.
  2. Build your project
  3. Publish your project with the command yarn publish --tag beta

This means your version will be accessible to everyone online but not overtake the mainline releases for anyone else installing your library.

How to link locally

If you want to test things more immediately and with less building, look into the link command. Here's how you can use it. For the purposes of this walkthrough, let's say that you are building the library @apmg/amat to be used in MPR News's website.

In @apmg/amat

  1. Build your project
  2. Run the command yarn link

In MPR News

  1. Run the command yarn remove @apmg/amat
  2. Run the command yarn link @apmg/amat

MPR News should now be using your local, just-built version of @apmg/amat