@kingjs/watch-package
v1.0.0
Published
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.
Downloads
1
Readme
@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.json
description and/or generatingREADME.md
from 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 generate
is executed in thepackage.json
directory. 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 generate
is 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
files
in thepackage.json
. Iffiles
is specified, then no files are watched for that package.
Install
With npm installed, run
$ npm install @kingjs/watch-package
Dependencies
|Package|Version|
|---|---|
|shelljs
|^1.0.0
|
|chokidar
|^2.1.1
|
Source
https://repository.kingjs.net/watch-package
License
MIT