Helpful, elegant, generically typed, boolean micromatch for lists of file paths in TypeScript.
- Works with CommonJS and ES Modules, too.
- Safer and more concise than using
- Designed for concise syntax in dangerfiles but not tied to them in any way.
I'm pleased to say as of Danger.js 7.1, this helper is vendored into
Danger and accessible as
const danger fail message warn =const chainsmoker =// In this example, these are all arrays of relative paths.const fileMatch =const documentation =const packageJson =const packageLock =const helpers =const helperTests =// This is `true` whenever there are matches in the corresponding path array.if documentationupdatedif packageJsonmodified && !packageLockmodifiedif helperscreated && !helperTestscreatedelse if helpersupdated && !helperTestsupdated
Return an object containing arrays of matched files instead of the usual boolean values.
Requires Node 8+.
npm install --save-dev chainsmoker
- Issue Tracker: https://github.com/paulmelnikow/chainsmoker/issues
- Source Code: https://github.com/paulmelnikow/chainsmoker
Pull requests welcome!
If you are having issues, please let me know.
The name 🚬
The name was inspired by the idea of a chainable file-set object using minimatch. It's also for Danger… maybe that was part of the inspiration.
I ended up with something simpler that doesn't rely on chaining, though I kept the name.
Thanks to @orta for reviewing this and shipping it with Danger.
The project is licensed under the MIT license.