Files
jspm-registry/README.md
T

89 lines
3.4 KiB
Markdown
Raw Normal View History

2013-11-12 18:15:04 +02:00
jspm Registry
2013-09-16 11:23:44 +02:00
---
2013-12-04 14:42:44 +02:00
[View the registry file here](https://github.com/jspm/registry/blob/master/registry.json)
Pull requests welcome for `registry.json` to add or modify entries.
2013-09-16 11:23:44 +02:00
2013-11-12 17:13:53 +02:00
All registry entries are managed here through Github, moderated by the registry maintainers.
2013-09-27 10:16:16 +02:00
2014-02-04 15:15:47 +02:00
Registry
2013-09-16 11:23:44 +02:00
---
2014-02-04 15:15:47 +02:00
Modules are served from _endpoint servers_. Endpoints include `github:` and `npm:`.
2013-09-16 11:23:44 +02:00
2014-02-04 15:15:47 +02:00
When requesting a module such as `github:twbs/bootstrap@3.0/js/bootstrap.js`, this corresponds to the URL
`https://github.jspm.io/twbs/bootstrap@3.0/js/bootstrap.js` and the **GitHub endpoint**, returns the associated code.
2013-11-12 17:25:43 +02:00
2013-11-12 17:13:31 +02:00
The registry simply remembers the `github:twbs/bootstrap` part, allowing the shortcut form:
```javascript
2014-02-04 10:40:43 +02:00
System.import('bootstrap@3.0/js/bootstrap');
2013-11-12 17:13:31 +02:00
```
2013-11-12 17:18:29 +02:00
The `registry.json` is just a collection of these mappings:
```javascript
"bootstrap": "github:twbs/bootstrap"
```
Anyone is welcome to submit a mapping.
The current supported endpoint servers are:
* Github (SPDY optimized)
* npm (SPDY optimized)
2014-02-04 15:15:47 +02:00
Package.json Overrides
---
2013-11-12 17:13:31 +02:00
The registry also provides a service for overriding the `package.json` of existing repos.
2013-11-12 18:15:04 +02:00
This is useful for enabling jspm functionality in the `package.json` when direct access to the underlying repo is not possible.
2013-11-12 17:32:51 +02:00
2013-11-12 18:15:04 +02:00
This is because jspm uses the `package.json` for modular package configuration, including:
2013-11-12 17:13:31 +02:00
* Setting the main entry point (`main`)
* Shim config for globals (`shim`)
2014-02-04 10:40:43 +02:00
* Map configuration (`map`)
* Module format (`format`)
* Auto-enabling minification (`buildOptions.minify`)
2013-11-12 17:13:31 +02:00
2013-12-07 15:15:23 +02:00
In this way, the right package options can make any package play well with jspm, without needing any manual configuration at all.
2013-11-12 17:13:31 +02:00
2013-11-12 17:32:51 +02:00
Submitting a pull request to the original repo is still preferable to package overrides, this is a convenience service only and not a long term solution.
2013-11-12 18:15:04 +02:00
Read more about [configuring packages for jspm](https://github.com/jspm/registry/wiki/Configuring-Packages-for-jspm) in the wiki.
2013-11-12 17:30:22 +02:00
2014-02-04 15:15:47 +02:00
Some examples of package.json overrides for common packages:
* [Bootstrap](https://github.com/jspm/registry/blob/master/package-overrides/github/twbs/bootstrap%403.0.2.json)
* [Backbone Marionette](https://github.com/jspm/registry/blob/master/package-overrides/github/marionettejs/backbone.marionette%401.2.2.json)
Further examples of jspm package.json files for common packages can be found in the [package overrides](https://github.com/jspm/registry/tree/master/package-overrides) section of the registry. Pull requests are encouraged.
### Testing Package Overrides
Package overrides may take some testing to get exactly the right configuration. The [jspm CLI](https://github.com/jspm/jspm-cli) provides an option to specify the package override for testing in this way.
Simply add the `-o` option to an install to set the package override:
```
jspm install github:twbs/bootstrap -o "{ main: 'js/bootstrap', shim: { 'js/bootstrap': ['jquery'] } }"
```
Once tested the exact override can then be included in the [jspm Registry](https://github.com/jspm/registry) with a pull request.
### Submitting a Package Override
2013-11-12 17:30:22 +02:00
To submit a new package override:
* Fork this repo, then create the file `package_overrides/[endpoint name]/[repo name]@x.y.z.json.
* Provide the correct configuration according to the configuration guide above.
* Submit a pull request.
* If the configuration is correct, this will be accepted and that will instantly enable the functionality on the endpoint.
The overrides only apply to exact version, tag or branch names.