DEV Community

Jim Burbridge
Jim Burbridge

Posted on • Edited on

3 2

[Request For Post] Your solution for auto publishing NPM packages?

Backstory

I recently created an NPM module that while it's not hugely popular, has more downloads than I thought it would. I have a CI/CD setup on my gitlab to lint, test, generate a changelog, and publish.

Three of those jobs work. Take a guess at which 3? That's right, linting, testing, and changelog-ing all work.

All of the places I've found mention of CI/CD with Gitlab and NPM boils down to the following:

  1. Either run npm config set registry //registry.npmjs.org/:_authToken ${NPM_TOKEN} and then running npm publish OR
  2. doing basically the same thing, but instead adding the //registry.npmjs.org/:_authToken=${NPM_TOKEN} to a local .npmrc file.

I've tried both of these on my WSL Ubuntu install. Neither has worked.

I found this Stack Overflow post, and in digging through some links found someone who recommended setting strict-ssl to false. I can't say I'm comfortable with that.

How do YOU do it?

Most of the time my CI/CD stuff pertains to servers, not necessarily NPM modules, so I'm a little out of flavor here. I figure there has to be some way to do this without turning off SSL? I'm holding off on updating my pipeline in the hopes that maybe there's something I missed in all my searching.

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs