File: README.md

package info (click to toggle)
node-npmrc 1.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 120 kB
  • sloc: makefile: 7; sh: 2
file content (177 lines) | stat: -rw-r--r-- 4,405 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
npmrc
=====

Switch between different .npmrc files with ease and grace.

Overview
--------

If you use a private npm registry, you know the pain of switching between a
bunch of different .npmrc files and manually managing symlinks. Let that be a
problem no more! `npmrc` is here to save the day, by making it dead simple to
switch out your .npmrc with a specific named version. It also tries to protect
you from your own stupid self by making sure you don't accidentally overwrite an
.npmrc that you actually want to keep.


Installation
------------

``` sh
npm install -g npmrc
```

Usage
-----

```
➜  ~  npmrc --help

npmrc

  Switch between different .npmrc files with ease and grace.

Usage:
  npmrc                 list all profiles
  npmrc [name]          change npmrc profile (uses fuzzy matching)
  npmrc -c [name]       create a new npmrc profile called name
  npmrc -r [registry]   use an npm mirror

Available mirrors for npmrc -r:
  au      - Australian registry mirror
  eu      - European registry mirror
  cn      - Chinese registry mirror
  default - Default registry
```

#### Initialisation

Calling `npmrc` without arguments creates an `~/.npmrcs/` directory if it doesn't exist,
and copies your current `~/.npmrc` as the 'default' .npmrc profile.

```
➜  ~  npmrc
Creating /Users/conrad/.npmrcs
Making /Users/conrad/.npmrc the default npmrc file
Activating .npmrc 'default'
```

#### Create a new .npmrc profile

```
➜  ~  npmrc -c newprofile
Removing old .npmrc (/home/rvagg/.npmrcs/default)
Activating .npmrc 'newprofile'
```

A blank profile will be created. To point your profile to a non-default registry:

```
➜  ~  npm config set registry http://npm.nodejs.org.au:5984/registry/_design/app/_rewrite
```

Then use `npm adduser` or `npm login` to authenticate with the new profile.


#### List available .npmrc profiles

```
➜  ~  npmrc 
Available npmrcs:
    
* default
  work
```

#### Switch to a specific .npmrc 

```
➜  ~  npmrc work
Removing old .npmrc (/Users/conrad/.npmrcs/default)
Activating .npmrc 'work'
```

You can also pass only the first few characters of a profile and `npmrc` will
autocomplete the profile's name.

```
➜  ~  npmrc def
Removing old .npmrc (/Users/conrad/.npmrcs/work)
Activating .npmrc 'default'
```

`npmrc <name>` will also go to some lengths to make sure you don't overwrite
anything you might care about:

```
➜  ~  npmrc default
Removing old .npmrc (/Users/conrad/.npmrcs/work)
Activating .npmrc 'default'
➜  ~  npmrc default  
Current .npmrc (/Users/conrad/.npmrc) is already 'default' (/Users/conrad/.npmrcs/default)
➜  ~  rm ~/.npmrc
➜  ~  touch ~/.npmrc
➜  ~  npmrc default
Current .npmrc (/Users/conrad/.npmrc) is not a regular file, not removing it
➜  ~  rm ~/.npmrc
➜  ~  npmrc default
Activating .npmrc 'default'
```

Note For Windows Users
----------------------

You may have to run npmrc in a shell (cmd, PowerShell, Git Bash, etc) with
elevated (Administrative) privileges to get it to run.

Environment Variables
---------------------

* `NPMRC_STORE` - Path to directory of profiles. Default: `~/.npmrcs/`
* `NPMRC` - Path to the npmrc file used by npm. Default: `~/.npmrc`

Known npm registry Mirrors
---------------------

For your convenience, you can change registries easily using the `-r`
flag. Currently we provide aliases for:

* [Australia](http://registry.npmjs.org.au/): `npmrc -r au`
* [Europe](http://registry.npmjs.eu/): `npmrc -r eu`
* [China](http://r.cnpmjs.org): `npmrc -r cn`

#### Switching registry example

```
➜  ~  npm -r eu
Using eu registry
➜  ~  npm info npmrc
npm http GET http://registry.npmjs.eu/npmrc
^C
➜  ~  npm -r default
Using default registry
➜  ~  npm info npmrc
npm http GET https://registry.npmjs.org/npmrc
^C
```

License
-------

3-clause BSD. A copy is included with the source.

Contact
-------

* GitHub ([deoxxa](http://github.com/deoxxa))
* Twitter ([@deoxxa](http://twitter.com/deoxxa))
* Email ([deoxxa@fknsrs.biz](mailto:deoxxa@fknsrs.biz))

Awesome People
--------------

* Jaime "the binary wizard" Pillora ([github](https://github.com/jpillora))
* Tim "two hands" Oxley ([github](https://github.com/timoxley))
* Jakob "fastest blur in the west" Krigovsky ([github](https://github.com/SonicHedgehog))
* Rod "the destroyer" Vagg ([github](https://github.com/rvagg))
* Eugene "ludicrous gibs" Asiedu ([github](https://github.com/ngenerio))