1# Maintaining npm in Node.js 2 3New pull requests should be opened when a "next" version of npm has 4been released. Once the "next" version has been promoted to "latest" 5the PR should be updated as necessary. 6 7The specific Node.js release streams the new version will be able to land into 8are at the discretion of the release and LTS teams. 9 10This process only covers full updates to new versions of npm. Cherry-picked 11changes can be reviewed and landed via the normal consensus seeking process. 12 13## Step 1: Clone npm 14 15```console 16$ git clone https://github.com/npm/cli.git npm 17$ cd npm 18``` 19 20or if you already have npm cloned make sure the repo is up to date 21 22```console 23$ git remote update -p 24$ git reset --hard origin/latest 25``` 26 27## Step 2: Build release 28 29```console 30$ git checkout vX.Y.Z 31$ make 32$ make release 33``` 34 35Note: please run `npm dist-tag ls npm` and make sure this is the `latest` 36**dist-tag**. `latest` on git is usually released as `next` when it's time to 37downstream 38 39## Step 3: Remove old npm 40 41```console 42$ cd /path/to/node 43$ git remote update -p 44$ git checkout -b npm-x.y.z origin/master 45$ cd deps 46$ rm -rf npm 47``` 48 49## Step 4: Extract and commit new npm 50 51```console 52$ tar zxf /path/to/npm/release/npm-x.y.z.tgz 53$ git add -A npm 54$ git commit -m "deps: upgrade npm to x.y.z" 55$ cd .. 56``` 57 58## Step 5: Update licenses 59 60```console 61$ ./configure 62$ make -j4 63$ ./tools/license-builder.sh 64# The following commands are only necessary if there are changes 65$ git add . 66$ git commit -m "doc: update npm LICENSE using license-builder.sh" 67``` 68 69Note: please ensure you are only making the updates that are changed by npm. 70 71## Step 6: Apply Whitespace fix 72 73```console 74$ git rebase --whitespace=fix master 75``` 76 77## Step 7: Test the build 78 79```console 80$ make test-npm 81``` 82