chokidar-cli
Advanced tools
Comparing version 1.1.1 to 1.2.0
# Contributing | ||
Pull requests and contributions are warmly welcome. | ||
Please follow existing code style and commit message conventions. Also remember to keep documentation | ||
updated. | ||
Please follow existing code style and commit message conventions. | ||
Remember to keep documentation updated. | ||
**Pull requests:** You don't need to bump version numbers or modify anything related to releasing. That stuff is fully automated, just write the functionality. | ||
**Pull requests:** You don't need to bump version numbers or modify anything | ||
related to releasing. That stuff is fully automated, just write the functionality. | ||
# Maintaining | ||
@@ -15,3 +15,7 @@ | ||
* Commit all changes | ||
* Run `./tools/release.js minor`, which will create new tag and publish code to GitHub and npm | ||
* Run `./node_modules/.bin/releasor --bump minor`, which will create new tag and publish code to GitHub and npm | ||
See [releasor documentation](https://github.com/kimmobrunfeldt/releasor) | ||
for detailed usage. | ||
* Edit GitHub release notes |
13
index.js
@@ -9,3 +9,2 @@ #!/usr/bin/env node | ||
var EVENT_DESCRIPTIONS = { | ||
@@ -52,3 +51,5 @@ add: 'File added', | ||
'Needs to be surrounded with quotes when command contains ' + | ||
'spaces' | ||
'spaces. Instances of `{path}` or `{event}` within the ' + | ||
'command will be replaced by the corresponding values from ' + | ||
'the chokidar event.' | ||
}) | ||
@@ -156,5 +157,9 @@ .option('d', { | ||
// TODO: commands might be still run concurrently | ||
// XXX: commands might be still run concurrently | ||
if (opts.command) { | ||
debouncedRun(opts.command); | ||
debouncedRun( | ||
opts.command | ||
.replace(/\{path\}/ig, path) | ||
.replace(/\{event\}/ig, event) | ||
); | ||
} | ||
@@ -161,0 +166,0 @@ }); |
101
package.json
{ | ||
"name": "chokidar-cli", | ||
"description": "Ultra-fast cross-platform command line utility to watch file system changes.", | ||
"version": "1.1.1", | ||
"keywords": [ | ||
"fs", | ||
"watch", | ||
"watchFile", | ||
"watcher", | ||
"watching", | ||
"file", | ||
"fsevents", | ||
"chokidar", | ||
"cli", | ||
"command", | ||
"shell", | ||
"bash" | ||
], | ||
"bin": { | ||
"chokidar": "./index.js" | ||
}, | ||
"homepage": "https://github.com/kimmobrunfeldt/chokidar-cli", | ||
"author": "Kimmo Brunfeldt <kimmobrunfeldt@gmail.com> (http://kimmobrunfeldt.github.io/)", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/kimmobrunfeldt/chokidar-cli.git" | ||
}, | ||
"bugs": { | ||
"url": "http://github.com/kimmobrunfeldt/chokidar-cli/issues" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"anymatch": "^1.1.0", | ||
"bluebird": "^2.9.24", | ||
"chokidar": "^1.0.1", | ||
"lodash": "^3.7.0", | ||
"shell-quote": "^1.4.3", | ||
"yargs": "^3.7.2" | ||
}, | ||
"devDependencies": { | ||
"commander": "^2.8.0", | ||
"mocha": "^2.2.4", | ||
"mustache": "^2.0.0", | ||
"semver": "^4.3.3", | ||
"shelljs": "^0.4.0", | ||
"string": "^3.1.1" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
} | ||
} | ||
"name": "chokidar-cli", | ||
"description": "Ultra-fast cross-platform command line utility to watch file system changes.", | ||
"version": "1.2.0", | ||
"keywords": [ | ||
"fs", | ||
"watch", | ||
"watchFile", | ||
"watcher", | ||
"watching", | ||
"file", | ||
"fsevents", | ||
"chokidar", | ||
"cli", | ||
"command", | ||
"shell", | ||
"bash" | ||
], | ||
"bin": { | ||
"chokidar": "./index.js" | ||
}, | ||
"homepage": "https://github.com/kimmobrunfeldt/chokidar-cli", | ||
"author": "Kimmo Brunfeldt <kimmobrunfeldt@gmail.com> (http://kimmobrunfeldt.github.io/)", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/kimmobrunfeldt/chokidar-cli.git" | ||
}, | ||
"bugs": { | ||
"url": "http://github.com/kimmobrunfeldt/chokidar-cli/issues" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"anymatch": "^1.1.0", | ||
"bluebird": "^2.9.24", | ||
"chokidar": "^1.0.1", | ||
"lodash": "^3.7.0", | ||
"shell-quote": "^1.4.3", | ||
"yargs": "^3.7.2" | ||
}, | ||
"devDependencies": { | ||
"commander": "^2.8.0", | ||
"mocha": "^2.2.4", | ||
"mustache": "^2.0.0", | ||
"releasor": "^1.2.1", | ||
"semver": "^4.3.3", | ||
"shelljs": "^0.4.0", | ||
"string": "^3.1.1" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
} | ||
} |
@@ -11,2 +11,3 @@ # Chokidar CLI | ||
> [brunch](http://brunch.io), | ||
> [gulp](https://github.com/gulpjs/gulp/), | ||
> [karma](http://karma-runner.github.io), | ||
@@ -68,3 +69,6 @@ > [PM2](https://github.com/Unitech/PM2), | ||
**Pass the path and event details in to your custom command | ||
```chokidar '**/*.less' -c 'if [ "{event}" = "change" ]; then npm run build-less -- {path}; fi;'``` | ||
**Detailed help** | ||
@@ -84,3 +88,6 @@ | ||
-c, --command Command to run after each change. Needs to be | ||
surrounded with quotes when command contains spaces | ||
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 | ||
@@ -87,0 +94,0 @@ [default: 400] |
@@ -19,3 +19,4 @@ // Test basic usage of cli. Contains confusing setTimeouts | ||
var TIMEOUT_WATCH_READY = 1000; | ||
var TIMEOUT_CHANGE_DETECTED = 500; | ||
var TIMEOUT_CHANGE_DETECTED = 700; | ||
var TIMEOUT_KILL = TIMEOUT_WATCH_READY + TIMEOUT_CHANGE_DETECTED + 1000; | ||
@@ -77,3 +78,3 @@ // Abs path to test directory | ||
killed = true; | ||
}, TIMEOUT_WATCH_READY + TIMEOUT_CHANGE_DETECTED + 1000); | ||
}, TIMEOUT_KILL); | ||
} | ||
@@ -96,2 +97,23 @@ }) | ||
}); | ||
it('should replace {path} and {event} in command', function(done) { | ||
var command = "echo '{event}:{path}' > " + CHANGE_FILE; | ||
setTimeout(function() { | ||
fs.writeFileSync(resolve('dir/a.js'), 'content'); | ||
}, TIMEOUT_WATCH_READY); | ||
run('node ../index.js "dir/a.js" -c "' + command + '"', { | ||
pipe: DEBUG_TESTS, | ||
cwd: './test', | ||
callback: function(child) { | ||
setTimeout(child.kill.bind(child), TIMEOUT_KILL); | ||
} | ||
}) | ||
.then(function() { | ||
var res = fs.readFileSync(resolve(CHANGE_FILE)).toString().trim(); | ||
assert.equal(res, 'change:dir/a.js', 'need event/path detail'); | ||
done() | ||
}); | ||
}); | ||
}); | ||
@@ -98,0 +120,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
131
5
21315
7
15
356