1 | Registry-specific configuraion
|
2 | ------------------------------
|
3 |
|
4 | With `yapm` you can use different npm registries at the same time without changing your config file.
|
5 |
|
6 | This change still does not allow you to combine packages from different registries.
|
7 |
|
8 | ### config
|
9 |
|
10 | This is how typical configuration looks like:
|
11 |
|
12 | ```
|
13 | [registries."https://registry.npmjs.org/"]
|
14 | _auth = (your auth string for public registry)
|
15 | email = john-doe@example.org
|
16 | ca = null
|
17 |
|
18 | [registries."http://localhost:4873/"]
|
19 | _auth = (your auth string for private registry)
|
20 | always-auth = true
|
21 | email = john@company.com
|
22 | ```
|
23 |
|
24 | It is compatible with npm, and you can override each config option for different registries.
|
25 |
|
26 | By default yapm saves `_auth` data under its respective registry, so yapm won't expose your passwords to a malicious 3rd party registry by mistake. See [here](multireg-sec.md) for details.
|
27 |
|
28 | ### publishConfig
|
29 |
|
30 | This feature is long known in npm, but with yapm it's more useful. We recommend to use `publishConfig` to specify registry for each package:
|
31 |
|
32 | ```
|
33 | publishConfig: {
|
34 | "registry": "https://registry.npmjs.org/"
|
35 | }
|
36 | ```
|
37 |
|
38 | If you do that, you can easily publish private and public packages to different places:
|
39 |
|
40 | ```sh
|
41 | /tmp$ cd private-pkg
|
42 | /tmp/private-pkg$ yapm publish
|
43 | http - PUT http://localhost:4873/private-pkg
|
44 | http - 201 http://localhost:4873/private-pkg
|
45 | + private-pkg@0.1.0
|
46 |
|
47 | /tmp/private-pkg$ cd ../public
|
48 | /tmp/public-pkg$ yapm publish
|
49 | http - PUT https://registry.npmjs.org/public-pkg
|
50 | http - 201 https://registry.npmjs.org/public-pkg
|
51 | + public-pkg@0.1.0
|
52 | ```
|
53 |
|
54 | You can have different passwords and auth data for your private and public registry, and you don't have to change configuration.
|
55 |
|