|
1 | 1 | # npm
|
2 | 2 |
|
3 |
| -:poop: npm is the default package manager for Node.js. It is not well designed so [pnpm](https://pnpm.js.org/) should typically be used instead: |
4 |
| -``` |
5 |
| -npm install --global pnpm |
| 3 | +:poop: npm is the default package manager for Node.js. It is not as optimized as |
| 4 | +alternative package managers, we use [Yarn](https://yarnpkg.com/en/). There are |
| 5 | +many ways to install yarn on different systems, but the easiest is through npm: |
| 6 | + |
| 7 | +```bash |
| 8 | +npm install -g yarn |
6 | 9 | ```
|
7 | 10 |
|
8 |
| -Once pnpm is installed you should use it in place of `npm` - any time you would use `npm`, type `pnpm` instead. The exception is for global modules - when you are installing something globally ([eslint](https://www.npmjs.com/package/eslint), [htmlhint](https://www.npmjs.com/package/htmlhint), [http-serve](https://www.npmjs.com/package/http-serve)) you should use `npm i -g <module>` to install or update it (this includes pnpm - use npm to update pnpm). |
| 11 | +You should use Yarn in any place you would use npm. You should node these differences: |
| 12 | +`npm install` is `yarn add`, and to install global packages you should use |
| 13 | +`yarn global add [package]` |
9 | 14 |
|
10 |
| -# MK npm registry |
| 15 | +## MK npm registry |
11 | 16 |
|
12 | 17 | We have a private npm registry used to host packages from our private repositories. To access
|
13 |
| -this registry you'll need to configure npm to use and log in to it. It uses your |
14 |
| -GitHub username and password to authenticate you. |
| 18 | +this registry you'll need to configure npm to use and log in to it. It uses Github |
| 19 | +to authenticate you |
15 | 20 |
|
16 |
| -Use the command below to log in to the registry. You'll use your GitHub username |
17 |
| -and password when prompted. If you use [two-factor authentication](https://help.github.com/articles/about-two-factor-authentication/) you'll |
18 |
| -need to specify your username like: `username.123456` where the numbers are a current |
19 |
| -2FA code. |
| 21 | +Go to https://registry.mkdecision.com and hit Login at the top right. Once you've |
| 22 | +authorized the Github app, you'll be redirected back to the main page where you'll |
| 23 | +see two commands in the header like below: |
20 | 24 |
|
| 25 | + |
| 26 | + |
| 27 | +Enter those commands in a console followed by this last command: |
| 28 | + |
| 29 | +```bash |
| 30 | +npm config set registry https://registry.mkdecision.com |
21 | 31 | ```
|
22 |
| -npm login --scope=@mkdecision --registry=https://registry.mkdecision.com |
23 |
| -``` |
| 32 | + |
| 33 | +The first two commands will configure authentication with the registry so that |
| 34 | +you can access it. The last will set it as your default repository. |
0 commit comments