frock-core-watcher
v1.0.0
Published
A file-watching reload core plugin for frock.
Downloads
5
Readme
frock-core-watcher
A file-watching reload core plugin for frock.
Quick-Start Example
The plugin can watch a list of files or directories, and reload frock when
changes are detected in any of them. To get started, add it to your project's
package.json
:
{
"name": "frock-reload-test-project",
"version": "0.0.0",
"dependencies": {
"frock": "^2.0.0",
"frock-core-watcher": "^1.0.0"
},
"frock": {
"cores": [
{
"handler": "frock-core-watcher",
"options": {
"watch": ["./mocks/**/*.js"],
"chokidarOptions": {
"usePolling": true
},
"watchFrockfile": true
}
}
]
}
}
Then use frock as normal. It will reload based on your list of watched files.
Reloading on Config File changes
You may wish to have frock reload its configuration when a file changes. This is
accomplished in the above example; if you pass the option watchFrockfile
the
loaded frockfile
will be added to the watchlist, and config will be reloaded
when it changes.
Watch Options
frock-core-watcher
uses chokidar for file watching; you may pass any
options straight through to chokidar with the chokidarOptions
key.
Testing
From the project directory:
$ npm test
License
Apache 2.0, see LICENSE for details.