Using Azure Pipelines, you can publish your npm packages to Azure Artifacts feeds or to public registries such as npmjs.com. Using the npm task, you can install or publish npm packages as well as run any npm commands.
To publish npm packages to your feed, follow the steps below to add and configure the npm task:
From within your pipeline, select the + sign to add a task to your pipeline, then search for the npm task. Select Add to add it to your pipeline.
Fill out the required fields as follows:
Display name: name of your task.
Command: publish
Working folder that contains package.json: path to the folder containing the target package.json and .npmrc files. Leave this blank if those files are at the root of your repo.
Registry location: select Target registry to publish to an Azure Artifacts feed. select your feed from the dropdown menu.
Follow the steps below to publish your npm packages to a public npm registry using the classic pipeline.
From within your pipeline, select the + sign to add a task to your pipeline, then search for the npm task. Select Add to add it to your pipeline.
Fill out the required fields and make sure you select External npm registry to point to the public registry. Enter the name of your service connection in the External Registry field or create a new service connection if you haven't done so already.
Display name: name of your task.
Command: publish
Working folder that contains package.json: path to the folder containing the target package.json and .npmrc files. Leave this blank if those files are at the root of your repo.
Registry location: select External npm registry to publish to public registries such as npmjs.com. Enter the name of your service connection.