{"id":16190165,"url":"https://github.com/paulmelnikow/chainsmoker","last_synced_at":"2025-09-05T02:32:49.540Z","repository":{"id":27325903,"uuid":"113395052","full_name":"paulmelnikow/chainsmoker","owner":"paulmelnikow","description":"Elegant, generically typed, boolean micromatch for lists of file paths","archived":false,"fork":false,"pushed_at":"2023-03-04T02:59:00.000Z","size":2345,"stargazers_count":4,"open_issues_count":31,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-29T06:10:22.457Z","etag":null,"topics":["filematch","keyed-paths","micromatch","minimatch","path-matching","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paulmelnikow.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-07T02:57:11.000Z","updated_at":"2022-12-09T22:17:11.000Z","dependencies_parsed_at":"2024-06-21T15:36:10.190Z","dependency_job_id":"6d250682-0186-4533-bb3c-31d778548e67","html_url":"https://github.com/paulmelnikow/chainsmoker","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulmelnikow%2Fchainsmoker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulmelnikow%2Fchainsmoker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulmelnikow%2Fchainsmoker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulmelnikow%2Fchainsmoker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paulmelnikow","download_url":"https://codeload.github.com/paulmelnikow/chainsmoker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232020711,"owners_count":18461396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["filematch","keyed-paths","micromatch","minimatch","path-matching","typescript"],"created_at":"2024-10-10T07:38:50.064Z","updated_at":"2024-12-31T18:51:36.027Z","avatar_url":"https://github.com/paulmelnikow.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chainsmoker\n\n[![version](https://img.shields.io/npm/v/chainsmoker.svg?style=flat-square)][npm]\n[![license](https://img.shields.io/npm/l/chainsmoker.svg?style=flat-square)][npm]\n[![types](https://img.shields.io/npm/types/chainsmoker.svg?style=flat-square)][npm]\n[![build](https://img.shields.io/circleci/project/github/paulmelnikow/chainsmoker.svg?style=flat-square)][build]\n[![code style](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)][prettier]\n\n[npm]: https://npmjs.com/chainsmoker/\n[build]: https://circleci.com/gh/paulmelnikow/chainsmoker/tree/master\n[prettier]: https://prettier.io/\n[lerna]: https://lernajs.io/\n\nElegant, generically typed, boolean [micromatch][] for lists of file paths in\nTypeScript.\n\n- Works with CommonJS and ES Modules, too.\n- Safer and more concise than using `.filter()` and `.length`.\n- Designed for concise syntax in [dangerfiles][danger] but not tied to them in\n  any way.\n\nI'm pleased to say as of [Danger.js 7.1][danger], this helper is vendored into\nDanger and accessible as `danger.fileMatch`.\n\n[micromatch]: https://github.com/micromatch/micromatch\n[danger]: http://danger.systems/js/\n\n## Usage\n\n```js\nconst { danger, fail, message, warn } = require('danger')\nconst chainsmoker = require('chainsmoker')\n\n// In this example, these are all arrays of relative paths.\nconst fileMatch = chainsmoker({\n  created: danger.git.created_files,\n  modified: danger.git.modified_files,\n  updated: danger.git.modified_files.concat(danger.git.created_files),\n  deleted: danger.git.deleted_files,\n})\n\nconst documentation = fileMatch(\n  '**/*.md',\n  'lib/all-badge-examples.js',\n  'frontend/components/usage.js'\n)\nconst packageJson = fileMatch('package.json')\nconst packageLock = fileMatch('package-lock.json')\nconst helpers = fileMatch('lib/**/*.js', '!**.spec.js')\nconst helperTests = fileMatch('lib/**/*.spec.js')\n\n// This is `true` whenever there are matches in the corresponding path array.\nif (documentation.updated) {\n  message('We :heart: our [documentarians](http://www.writethedocs.org/)!')\n}\n\nif (packageJson.modified \u0026\u0026 !packageLock.modified) {\n  warn('This PR modified package.json, but not package-lock.json')\n}\n\nif (helpers.created \u0026\u0026 !helperTests.created) {\n  warn('This PR added helper modules in lib/ but not accompanying tests.')\n} else if (helpers.updated \u0026\u0026 !helperTests.updated) {\n  warn('This PR modified helper modules in lib/ but not accompanying tests.')\n}\n```\n\n**fileMatch.getKeyedPatterns()**\n\nReturn an object containing arrays of matched files instead of the usual\nboolean values.\n\n## Installation\n\nRequires Node 8+.\n\n```\nnpm install --save-dev chainsmoker\n```\n\n## Contribute\n\n- Issue Tracker: https://github.com/paulmelnikow/chainsmoker/issues\n- Source Code: https://github.com/paulmelnikow/chainsmoker\n\nPull requests welcome!\n\n## Support\n\nIf you are having issues, please let me know.\n\n## The name :smoking:\n\nThe name was inspired by the idea of a chainable file-set object using\nminimatch. It's also for Danger… maybe that was part of the inspiration.\n\nI ended up with something simpler that doesn't rely on chaining, though I kept\nthe name.\n\n## Acknowledgements\n\nThanks to [@orta][] for reviewing this and shipping it with Danger.\n\n[@orta]: http://github.com/orta\n\n## License\n\nThe project is licensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulmelnikow%2Fchainsmoker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaulmelnikow%2Fchainsmoker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulmelnikow%2Fchainsmoker/lists"}