1.0.0 • Published 7 years ago
@kingjs/watch-package v1.0.0
@kingjs/watch-package
A tool which, for each package.json found in any subdirectory, excluding dot directories, runs npm run generate in the subdirectory whenever a change is made to any file explicitly included in the package.
API
watchPackages()Remarks
- This tool was developed to automate manual tasks that updated and/or generated files from source code. For example, updating
package.jsondescription and/or generatingREADME.mdfrom JsDoc comments found in source. - Various heuristics are used to attempt to only kick off runs in response to manual interactions:
- After a change is detected, a timer starts. If 100ms elapses without another change then
npm run generateis executed in thepackage.jsondirectory. If another change is detected with that 100ms, then the timer restarts. This should batch changes made by Save All or Replace All. - Watching is suspended while
npm run generateis executing. This way changes made by the run itself do not generate subsequent runs.
- After a change is detected, a timer starts. If 100ms elapses without another change then
- The watched files are those specified in
filesin thepackage.json. Iffilesis specified, then no files are watched for that package.
Install
With npm installed, run
$ npm install @kingjs/watch-packageDependencies
| Package | Version |
|---|---|
shelljs | ^1.0.0 |
chokidar | ^2.1.1 |
Source
https://repository.kingjs.net/watch-package
License
MIT
1.0.0
7 years ago