https://github.com/opencomponents/oc-warmup
A node.js module for warming up an OpenComponents registry
https://github.com/opencomponents/oc-warmup
opencomponents
Last synced: 8 months ago
JSON representation
A node.js module for warming up an OpenComponents registry
- Host: GitHub
- URL: https://github.com/opencomponents/oc-warmup
- Owner: opencomponents
- License: mit
- Created: 2016-02-24T02:31:42.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-01-18T14:41:01.000Z (about 8 years ago)
- Last Synced: 2025-06-13T07:49:45.766Z (8 months ago)
- Topics: opencomponents
- Language: JavaScript
- Size: 9.77 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-oc - Registry Warmup - Module for warming up a registry instance (Registry Plugins/Utilities)
README
oc-warmup [](http://travis-ci.org/opencomponents/oc-warmup)
===============
[](https://greenkeeper.io/)
[](https://npmjs.org/package/oc-warmup)
Allows to warmup all components for a given [OpenComponents](https://github.com/opentable/oc)' registry. In practice, given every registry's instance has an internal cache for components' compiled views and server.js' closures, the module performs the following actions:
* It scans the registry to retrieve components' list
* Requests info for each component (latest version only) in order to get components' API (mandatory parameters and example values)
* Makes a POST request for all components so that the cache is populated from S3
* Responds with the list of components that responded with a 200 or not
```js
var warmup = require('oc-warmup');
warmup({
url: 'http://registry-01234.mycompany.com/',
// optional params
components: c => c.name === 'header' && c.oc.state !== 'deprecated',
headers: { 'accept-language': 'en-US' },
timeout: 20000
}, (error, result) => {
console.log(error);
// => something like 'error connecting to registry' or null
console.log(result);
// => something like { successful: ['a', 'b'], errors: ['* c: error blabla (500)']}
});
```
# License
MIT