## First time using Azure Artifacts with npm on your computer?

Step 1. Dowload Node.js and npm

Step 2. Run this command `npm install -g vsts-npm-auth --always-auth false`

## Add the registry to your project

Add a .npmrc to your project, in the same directory as your package.json

```
@enterprise-ui:registry=https://pkgs.dev.azure.com/waresources/_packaging/Enterprise-ui/npm/registry/
always-auth=true
```

## Get a token. Required periodically

Run vsts-npm-auth to get an Azure Artifacts token added to your user-level .npmrc file

```
vsts-npm-auth -config .npmrc
```

Note: You don't need to do this every time. npm will give you a 401 Unauthorized error when you need to run it again.

Having issues? See the instructions for using a Personal Access Token to authenticate on the Azure Artifacts help guide

https://dev.azure.com/waresources/Design%20Systems/_packaging?_a=feed&feed=DesignSystems

## Install package

In your root folder `npm install @enterprise-ui`

## Compile to css

Run `npm run css-build`

## Publish package

Install dependencies `npm install`

Build the package in a bash shell `npm run build` to create the dist/ folder

Modify the package.json file to include a -beta in the version, i.e. 1.0.0-beta.0

Run `npm pack` to package up the file prior to publishing to check all the packages as expected.

Run `npm publish --tag beta` to upload to the .nmprc registry

Run `npm install @enterprise-ui/<package-name>@1.0.0-beta.0` in the project root folder to test if it install and behave correctly

Once you are happy, modify the package.json file, removing the -beta.

Run `npm publish` for final packaging and uploading to the .npmrc registry

## Publishing to a new Azure feed

From the Azure DevOps menu, choose Artifacts

Create a new feed with a name

Set the visibility to Members of waresources

Ensure the default Include upstream sources such as npmjs.com is checked

