1.4.0 • Published 7 years ago
organic-watch-json-dir v1.4.0
organic-watch-json-dir
Organelle for emitting changes in directory with .json files.
How to install
The minimal version of nodejs is: Nodejs version 4+
Open your terminal and run:
npm install organic-watch-json-dir --savedna
{
"location": "/full/path/with/json/files",
"reactOn": ChemicalPattern,
"emit": {
"dataPropertyName": "data",
"onChangeFile": ChemicalType || Function,
"onNewFile": ChemicalType || Function,
"onDeleteFile": ChemicalType || Function,
"ready": ChemicalType,
"errors": ChemicalType
},
"chokidar": {
"awaitWriteFinish": {
"stabilityThreshold": 100,
"pollInterval": 10
}
}
}reacts
reactOn chemical pattern is optional, if not present will execute during build(construction) phase.
emits
.json file related
onChangeFileemits when file has been touchedonNewFileemits when file has been created or it has been initially foundonDeleteFileemits when file has been removed (with a cached autoloaded data)
all chemicals have the following shape:
{
type: dna.emit.*,
<dna.emit.dataPropertyName>: JSON,
path: String
}- note that invalid json files will not trigger emits
- when dna.emitkey is
Functionit will be invoked asdna.emit[key](c)wherecis chemical having the above outlined shape.
ready
ready is optional, if present will emit in plasma dna specified plain chemical type.
errors
errors is optional, if present will emit any errors found during loading and parsing respective (new/changed) json files.
Contributing
We :hearts: contribution so send your PRs accordingly. Dont forget to update the README and tests along the way ;)