# Javascript Package Management Setup

There are currently two package management repositories in use - Packagecloud and Github. Each of these require setting 
security tokens for local development.

To get started, ensure that you have a `.npmrc` file defined in either your home folder `~/.npmrc` or in the directory 
for your project (`~/.npmrc` is probably better so you don't have to configure for each project).

Copy the following into your `.npmrc` file:

```
always-auth=true

registry=https://registry.npmjs.org/
@orchard:registry=https://packagecloud.io/orchardit/npm/npm/
@theorchard:registry=https://npm.pkg.github.com/

//packagecloud.io/orchardit/npm/npm/:_authToken=[PACKAGECLOUD_TOKEN]
//npm.pkg.github.com/:_authToken=[GITHUB_TOKEN]
```

Obtain the tokens using the following processes.

## Github

Go to https://github.com/settings/tokens/new to create a new token. Check the `"repo"` and the `"read:packages"` scope:

<img src="./img/github-access-token.png" />

## Packagecloud

Since we started using packagecloud.io as a private NPM registry, we have all been sharing the same access token. This 
is one of the main reasons for moving to just using Github.

Please reach out to [Magnus Solvåg](https://orcd.slack.com/archives/DAV4F3PU7) or other team members that already have 
this set up.

Hint: it is probably already in your existing .npmrc file.
