乔基达尔CLI
快速跨平台命令行工具来监视文件系统的变化.
基本手表库是 乔基达尔这是最好的表之一 节点水电费。 Chokidar是战斗测试.
安装
如果你只需要国家防范机制的脚本:
npm install @aoberoi/chokidar-cli
或全球
npm install -g @aoberoi/chokidar-cli
使用量
默认 chokidar 串流改变所有模式以显示 :
$ chokidar '**/*.js' '**/*.less'
change:test/dir/a.js
change:test/dir/a.less
add:test/b.js
unlink:test/b.js
每个变化都以格式表示 event:relativepath可能的活动: add, (中文(简体) ), unlink, (中文(简体) ), addDir, (中文(简体) ), unlinkDir, (中文(简体) ),
change。 。 。 .
仅在每次更改上输出相对路径
$ chokidar '**/*.js' '**/*.less' | cut -d ':' -f 2-
test/dir/a.js
test/dir/a.less
test/b.js
test/b.js
运行 npm 运行构建 -js 当前工作目录树中任何 .js 文件更改时
chokidar '**/*.js' -c 'npm run build-js'
在网络目录中观看必须使用投票
chokidar '**/*.less' -c 'npm run build-less' --polling
将路径和事件细节传递到您的自定义命令
chokidar '**/*.less' -c 'if [ "{event}" = "change" ]; then npm run build-less -- {path}; fi;'
详细帮助
Usage: chokidar <pattern> [<pattern>...] [options]
<pattern>:
Glob pattern to specify files to be watched.
Multiple patterns can be watched by separating patterns with spaces.
To prevent shell globbing, write pattern inside quotes.
Guide to globs: https://github.com/isaacs/node-glob#glob-primer
Options:
-c, --command Command to run after each change. Needs to be
surrounded with quotes when command contains spaces.
Instances of `{path}` or `{event}` within the command
will be replaced by the corresponding values from the
chokidar event.
-d, --debounce Debounce timeout in ms for executing command
[default: 400]
-t, --throttle Throttle timeout in ms for executing command
[default: 0]
-s, --follow-symlinks When not set, only the symlinks themselves will be
watched for changes instead of following the link
references and bubbling events through the links path
[boolean] [default: false]
-i, --ignore Pattern for files which should be ignored. Needs to be
surrounded with quotes to prevent shell globbing. The
whole relative or absolute path is tested, not just
filename. Supports glob patters or regexes using
format: /yourmatch/i
--initial When set, command is initially run once
[boolean] [default: false]
--concurrent When set, command is not killed before invoking again
[boolean] [default: false]
-p, --polling Whether to use fs.watchFile(backed by polling) instead
of fs.watch. This might lead to high CPU utilization.
It is typically necessary to set this to true to
successfully watch files over a network, and it may be
necessary to successfully watch files in other non-
standard situations [boolean] [default: false]
--poll-interval Interval of file system polling. Effective when --
polling is set [default: 100]
--poll-interval-binary Interval of file system polling for binary files.
Effective when --polling is set [default: 300]
--verbose When set, output is more verbose and human readable.
[boolean] [default: false]
--silent When set, internal messages of chokidar-cli won't be
written. [boolean] [default: false]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
Examples:
chokidar "**/*.js" -c "npm run build-js" build when any .js file changes
chokidar "**/*.js" "**/*.less" output changes of .js and .less
files
鸣谢
感谢 金莫·布伦费尔特 开始这个项目并走得很远 一、导 言 维持了临时叉以登陆一个直到2018年12月才取得任何进展的地物,在该地上 我决定去掉"临时"的标签 没有所有贡献者,这个项目是不可能的 原计划.