1.4.0 • Published 5 years ago

organic-watch-json-dir v1.4.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

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 --save

dna

{
  "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

  • onChangeFile emits when file has been touched
  • onNewFile emits when file has been created or it has been initially found
  • onDeleteFile emits 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 Function it will be invoked as dna.emit[key](c) where c is 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 ;)

1.4.0

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago