1 | * [Customizing Registries](#customizing-registries)
|
2 | * [Auto-configuring Registries](#auto-configuring-registries)
|
3 | * [Creating a private jspm registry](#creating-a-private-jspm-registry)
|
4 | * [Creating new Registries](#creating-new-registries)
|
5 |
|
6 | ### Customizing Registries
|
7 |
|
8 | All registries have configuration options for setting their server URIs, auth credentials and settings.
|
9 |
|
10 | #### Private GitHub
|
11 |
|
12 | To support private GitHub, simply authenticate with your private GitHub account:
|
13 |
|
14 | ```
|
15 | jspm registry config github
|
16 | ```
|
17 |
|
18 | ```
|
19 | Would you like to set up your GitHub credentials? [yes]:
|
20 | If using two-factor authentication or to avoid using your password you can generate an access token at https://github.com/settings/tokens.
|
21 |
|
22 | Enter your GitHub username: username
|
23 | Enter your GitHub password or access token:
|
24 | Would you like to test these credentials? [yes]:
|
25 | ```
|
26 |
|
27 | This will enable private repo installs.
|
28 |
|
29 | #### Private npm
|
30 |
|
31 | When available, the npm registry endpoint will automatically pull authentication details from the local `.npmrc` file, so that private npm scopes and registries should be configured automatically.
|
32 |
|
33 | To set up manual credentials, use:
|
34 |
|
35 | ```
|
36 | jspm registry config npm
|
37 | ```
|
38 |
|
39 | ### Auto-configuring Registries
|
40 |
|
41 | All registries can export their exact configurations including authentication via `jspm registry export` which can be included in an init script in such an environment:
|
42 |
|
43 | ```
|
44 | jspm registry export github
|
45 | jspm config registries.github.remote https://github.jspm.io
|
46 | jspm config registries.github.auth JSPM_GITHUB_AUTH_TOKEN
|
47 | jspm config registries.github.maxRepoSize 100
|
48 | jspm config registries.github.handler jspm-github
|
49 | ```
|
50 |
|
51 | #### GitHub Authentication Environment Variable
|
52 |
|
53 | GitHub is rate-limited by IP so that when running automated installs for testing or other workflows, it is necessary to configure authentication, otherwise a `GitHub rate limit reached.` error message will likely be displayed.
|
54 |
|
55 | To make authentication easier, an environment variable `JSPM_GITHUB_AUTH_TOKEN` can be set on the automated server, containing exactly the value of `registries.github.auth` when running `jspm registry export github`, after configuring GitHub authentication manually via `jspm registry config github`.
|
56 |
|
57 | > This `JSPM_GITHUB_AUTH_TOKEN` is an unencrypted Base64 encoding of the GitHub username and *password* or *access token* separated by a `:`, e.g. `username:token`.
|
58 |
|
59 | ### Creating a private jspm Registry
|
60 |
|
61 | You may wish to run your own version of the jspm registry instead of using the publicly maintained default. Running your own registry is particularly useful if you want to create short names to private packages and test lots of overrides.
|
62 |
|
63 | ```
|
64 | git clone git@github.com:jspm/registry jspm-registry
|
65 | jspm registry config jspm
|
66 | Enter the registry repo path [git@github.com:jspm/registry]: path/to/jspm-registry/.git
|
67 | ```
|
68 |
|
69 | Now when you install or update a module your private registry will be used instead of the public registry.
|
70 |
|
71 | You can also host the private registry as a shared internal git repo allowing for a company-wide registry.
|
72 |
|
73 | It is advisable to periodically maintain upstream updates from the jspm registry into this fork.
|
74 |
|
75 | ### Creating New Registries
|
76 |
|
77 | #### Custom Registries
|
78 |
|
79 | Third-party registries are listed at https://github.com/jspm/jspm-cli/wiki/Third-Party-Resources#registries.
|
80 |
|
81 | If you wish to create a custom registry for another type of package registry, this can be done by implementing the [Registry API](registry-api.md).
|
82 |
|
83 | The custom registry can be installed through npm:
|
84 |
|
85 | ```
|
86 | npm install custom-registry
|
87 | jspm registry create myregistry custom-registry
|
88 | ```
|
89 |
|
90 | > If using locally-scoped jspm, then the above install is local. If using global jspm, then the above install is global.
|
91 |
|
92 | If your registry endpoint is general enough that it would be of value to other users please do share it for inclusion in the third-party registry endpoint list.
|
93 |
|
94 | #### GitHub enterprise support
|
95 |
|
96 | It is possible to create a GitHub enterprise support with:
|
97 |
|
98 | ```
|
99 | jspm registry create mycompany jspm-github
|
100 | Are you setting up a GitHub Enterprise endpoint? [yes]:
|
101 | Enter the hostname of your GitHub Enterprise server: mycompany.com
|
102 | Would you like to set up your GitHub credentials? [yes]:
|
103 | ```
|
104 |
|
105 | Note that GitHub enterprise support has not been comprehensively tested, as we've had to rely on feedback and PRs from GitHub enterprise users. If there are any issues at all please post an issue and we'll work to fix these.
|
106 |
|
107 | #### Separate private npm
|
108 |
|
109 | > **Note that it is not advisable to create an registry with a different name to `npm` or `github` if it is a mirror, as the goal is for registry names to be canonical and universal.**
|
110 |
|
111 | This can be setup with:
|
112 |
|
113 | ```
|
114 | jspm registry create myregistry jspm-npm
|
115 | ```
|
116 |
|
117 | We now have an `npm` registry based on a custom registry and authentication which can be used as expected:
|
118 |
|
119 | ```
|
120 | jspm install myregistry:package
|
121 | ```
|