Private NPM Package deployment using VSTS

How to publish and consume NPM packages with VSTS

Shems Eddine
SHEMSEDDINE on Code

--

In my previous article, I explained how you can automate the deployment of your internal Nuget packages using VSTS and how to consume them. Today, I’m going to show you how you can use a very similar setup to build, deploy and consume NPM package all within VSTS.

We will create a simple package that will allow us to audit our function calls. In reality, it is just going to print it out to the console; probably not a practical example but it will suffice for this article.

Prerequisites:

  • Install Node.js and NPM
  • Some experience with Node.js and NPM packages
  • You will need Visual Studio Code
  • VSTS account (sign up at visualstudio.com)
  • Ensure you have the Package Manager Extension installed on VSTS

Our NPM package

Open up VS Code and let’s create our project, as_audit_trail

run the command

npm init -y

The -y flag means that it will construct the package.json for us and populates some of it to help us get started.

Okay I’ve exported a simple function called audit which just prints out the input.

--

--

Shems Eddine
SHEMSEDDINE on Code

Azure Cloud Platform Expert | NodeJS & .NET Senior Consultant | Startup CTO in City of London