{"id":21157746,"url":"https://github.com/christophervoigt/cattleman","last_synced_at":"2026-04-24T08:32:27.468Z","repository":{"id":57195060,"uuid":"96676607","full_name":"christophervoigt/cattleman","owner":"christophervoigt","description":"a helper library that gathers files and entry points","archived":false,"fork":false,"pushed_at":"2019-03-12T18:44:36.000Z","size":60,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-01T04:21:00.415Z","etag":null,"topics":["bundle","entry","file","helper","library","modular","multiple"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/christophervoigt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-09T10:18:13.000Z","updated_at":"2023-08-15T11:51:51.000Z","dependencies_parsed_at":"2022-09-16T05:20:51.675Z","dependency_job_id":null,"html_url":"https://github.com/christophervoigt/cattleman","commit_stats":null,"previous_names":["christophervoigt/cattleman","chlorophyllkid/cattleman"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/christophervoigt/cattleman","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophervoigt%2Fcattleman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophervoigt%2Fcattleman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophervoigt%2Fcattleman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophervoigt%2Fcattleman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/christophervoigt","download_url":"https://codeload.github.com/christophervoigt/cattleman/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophervoigt%2Fcattleman/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32216215,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T08:24:32.376Z","status":"ssl_error","status_checked_at":"2026-04-24T08:24:26.731Z","response_time":64,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["bundle","entry","file","helper","library","modular","multiple"],"created_at":"2024-11-20T12:07:45.637Z","updated_at":"2026-04-24T08:32:27.453Z","avatar_url":"https://github.com/christophervoigt.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cattleman\n[![NPM Version](http://img.shields.io/npm/v/cattleman.svg?style=flat)](https://www.npmjs.com/package/cattleman)\n[![NPM Downloads](https://img.shields.io/npm/dm/cattleman.svg?style=flat)](https://npmcharts.com/compare/cattleman?minimal=true)\n[![Build Status](https://travis-ci.org/chlorophyllkid/cattleman.svg?branch=master)](https://travis-ci.org/chlorophyllkid/cattleman)\n[![Coverage Status](https://coveralls.io/repos/github/chlorophyllkid/cattleman/badge.svg?branch=master)](https://coveralls.io/github/chlorophyllkid/cattleman?branch=master)\n[![Dependency Status](https://david-dm.org/chlorophyllkid/cattleman.svg)](https://david-dm.org/chlorophyllkid/cattleman)\n[![CodeFactor](https://www.codefactor.io/repository/github/chlorophyllkid/cattleman/badge)](https://www.codefactor.io/repository/github/chlorophyllkid/cattleman)\n\nCattleman is a small helper library. It parses a given directory and gathers files and entry objects.\nThese objects can be used in bundler configurations (e.g. [webpack](https://github.com/webpack/webpack) or [rollup](https://github.com/rollup/rollup)) to extend the entry property.\n\n\n## Installation\nInstall it with npm:\n```shell\n$ npm install cattleman --save-dev\n```\n\n\n## Usage\nRequire it for example in your `webpack.config.js` like:\n\n```javascript\nconst Cattleman = require('cattleman')\n\nlet config = {\n    entry: {\n        bundle: [ 'src/bundle.js', 'src/bundle.css' ]\n    },\n    output: {\n        filename: 'modules/[name].js',\n        path: __dirname + '/dist'\n    },\n    module: {\n        rules: [ ... ]\n    },\n    plugins: [ ... ]\n}\n\nconst cattleman = new Cattleman('src/modules')\nconst entries = cattleman.gatherEntries()\n\nconfig.entry = Object.assign({}, config.entry, entries)\n\nmodule.exports = config\n\n```\n\n\n## Options\nYou can init a cattleman instance without options. These are the defaults:\n```javascript\ndefaults = {\n    directory:   'src',    // search directory\n    excludes:  [ 'test' ]  // filepaths, which include a string listed here, are ignored\n}\n```\nIf you just pass a string to the constructor, cattleman interprets it as the directory.\n\n\n## Methods\n* **gatherFiles( extentionFilter )** - returns the list of files in the search directory\n\n[optional] *extentionFilter* - (string | array) - valid file type(s) (e.g. `'.js'` or `['.js', '.css']`)\n\n**Warning**: If extentionFilter equals an empty array, no extention is valid.\n\n\n## Example\nLet's say you got a `src/` folder in your projects directory containing the code of your site:\n```bash\nsrc/\n└─ modules/\n  ├─ footer/\n  │ ├─ footer.css\n  │ ├─ footer.html\n  │ └─ footer.js\n  ├─ header/\n  │ ├─ header.css\n  │ ├─ header.html\n  │ └─ header.js\n  └─ ...\n```\nImagine there are 20 - 30 modules more.\n\n\n```javascript\nconst cattleman = new Cattleman('src/modules')\n\nconst files = cattleman.gatherFiles()\n// now files whould look like this\n[\n    'src/modules/footer/footer.css',\n    'src/modules/footer/footer.html',\n    'src/modules/footer/footer.js',\n    'src/modules/header/header.css',\n    'src/modules/header/header.html',\n    'src/modules/header/header.js',\n    ...\n]\n\nconst jsFiles = cattleman.gatherFiles('.js')\n// now jsFiles whould look like this\n[\n    'src/modules/footer/footer.js',\n    'src/modules/header/header.js',\n    ...\n]\n\nconfig.entry = {\n    bundle: jsFiles\n}\n\nmodule.exports = config\n```\n\n\n## License\nThis library was written by [Christopher Voigt](https://twitter.com/chlorophyllkid) and is licensed under [MIT](https://github.com/chlorophyllkid/cattleman/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristophervoigt%2Fcattleman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristophervoigt%2Fcattleman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristophervoigt%2Fcattleman/lists"}