Back to the list

Create a tag for a npm package

jeudi 17 février 2022-1 min read

Picture of Angèle Kamptoto sur Unsplash

Recently, I had a specific need on one of my npm modules for the mobile app of Colisweb.

The latest version of rescript-logger use a GLIB_C version which is not available on our mobile app CI image and I can't change this image, so I didn't had any other choice than downgrade the version.

To do this, I created a npm tag -mobile in which I published the supported version with the CI.

Create a tag

To create a tag, you need to add as suffix the name you want in the version field in of your package.json. For example :

{
  "version": "2.1.2-mobile"
}

When you will publish your module, you will have to specify the tag in the command.

npm publish --tag mobile

Use the tag

In the project requiring the tag, you can add it by an install command :

yarn add 
# or
npm i 

Or manually in your package.json :

{
  "dependencies": {
	  "my-module": "2.1.2-mobile"
	}
}