{"id":13902936,"url":"https://github.com/bencoveney/barrelsby","last_synced_at":"2025-05-14T01:08:43.956Z","repository":{"id":37773842,"uuid":"82218952","full_name":"bencoveney/barrelsby","owner":"bencoveney","description":"Automatic TypeScript barrels (index.ts files) for your entire code base","archived":false,"fork":false,"pushed_at":"2025-04-28T15:42:33.000Z","size":1769,"stargazers_count":574,"open_issues_count":13,"forks_count":51,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-05T22:41:12.527Z","etag":null,"topics":["barrel","cli","index","node","npm","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/bencoveney.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"zenodo":null}},"created_at":"2017-02-16T19:40:54.000Z","updated_at":"2025-05-03T20:42:18.000Z","dependencies_parsed_at":"2023-12-19T10:02:37.448Z","dependency_job_id":"24386545-fada-45f6-b47e-889649edf5eb","html_url":"https://github.com/bencoveney/barrelsby","commit_stats":{"total_commits":293,"total_committers":20,"mean_commits":14.65,"dds":0.6040955631399317,"last_synced_commit":"dc8d4873eac803fb456f6656ec2479ebd7491b64"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencoveney%2Fbarrelsby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencoveney%2Fbarrelsby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencoveney%2Fbarrelsby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencoveney%2Fbarrelsby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bencoveney","download_url":"https://codeload.github.com/bencoveney/barrelsby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253401447,"owners_count":21902672,"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":["barrel","cli","index","node","npm","typescript"],"created_at":"2024-08-06T22:01:30.564Z","updated_at":"2025-05-14T01:08:38.943Z","avatar_url":"https://github.com/bencoveney.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","cli"],"sub_categories":[],"readme":"# ![Barrelsby Logo](https://github.com/bencoveney/barrelsby/blob/master/img/logo.png?raw=true)\n\nAutomatically create TypeScript barrels for your entire code base.\n\n[![npm version](https://badge.fury.io/js/barrelsby.svg)](https://badge.fury.io/js/barrelsby)\n[![Node.js CI](https://github.com/bencoveney/barrelsby/actions/workflows/node.js.yml/badge.svg?branch=master)](https://github.com/bencoveney/barrelsby/actions/workflows/node.js.yml)\n[![CodeQL](https://github.com/bencoveney/barrelsby/actions/workflows/codeql-analysis.yml/badge.svg?branch=master)](https://github.com/bencoveney/barrelsby/actions/workflows/codeql-analysis.yml)\n\n## About Barrels\n\nBarrels are files that rollup exports from several modules into a single convenient module\ntypically named `index.ts`. They tend to help simplify large blocks of import statements at the top\nof files and help to group up related functionality.\n\nA barrel file looks like this:\n\n```TypeScript\nexport * from \"./DropDown\";\nexport * from \"./TextBox\";\nexport * from \"./CheckBox\";\nexport * from \"./DateTimePicker\";\nexport * from \"./Slider\";\n```\n\nIt can help you go from messy imports like this:\n\n```TypeScript\nimport {DropDown} from \"./src/controls/DropDown\";\nimport {TextBox} from \"./src/controls/TextBox\";\nimport {CheckBox} from \"./src/controls/CheckBox\";\nimport {DateTimePicker} from \"./src/controls/DateTimePicker\";\nimport {Slider} from \"./src/controls/Slider\";\n```\n\n...to something tidier like this:\n\n```TypeScript\nimport {DropDown, TextBox, CheckBox, DateTimePicker, Slider} from \"./src/controls\";\n```\n\n...or even this:\n\n```TypeScript\nimport * as Controls from \"./src/controls/index\";\n```\n\n### More Reading\n\n* [TattooCoder Blog](http://tattoocoder.com/angular2-barrels/)\n\n### Barrelsby Articles\n\n* [Rupesh Tiwari Blog](http://rupeshtiwari.com/create-barrel/)\n* [Medium Article](https://medium.com/@klauskpm/do-a-barrel-export-aa5b79b76b05)\n\n### Alternatives\n\n* [Barrelbot](https://github.com/sw-yx/barrelbot)\n* [creeate-index](https://github.com/gajus/create-index)\n\n## Usage\n\nTo install Barrelsby:\n\n```\nnpm install --save-dev barrelsby\n```\n\nTo run barrelsby first add a script to the `package.json` file:\n\n```json\n{\n  \"scripts\": {\n    \"generate-barrels\": \"barrelsby --delete\"\n  }\n}\n```\n\nYou can now generate barrels:\n\n```\nnpm run generate-barrels\n```\n\n## Configuration Options\n\nBarrelsby accepts a number of options to help refine how your barrels are created. These options\ncan be configured from the command line or using a configuration file.\n\n### `-c [path]` or `--config [path]`\n\nSpecifies the location of the barrelsby configuration file. This file must be a `.json` file. You\ncan include any of the configuration options using their long name.\n\n### `-d [path...]` or `--directory [path...]`\n\nSpecifies a list of root directories where barrels will be created from. Uses the current directory\nby default.\n\n**Note**: This is backwards compatible with previous versions. Existing configuration files will be\nparsed correctly. The following two json files will behave identically.\n\n```json lines\n{\n  \"directory\": \"./src\"\n}\n\n{\n  \"directory\": [\"./src\"]\n}\n```\n\n### `-D` or `--delete`\n\nDeletes any existing barrels encountered by barrelsby. Disabled by default.\n\n### `-e [regex...]` or `--exclude [regex...]`\n\nExcludes any files whose paths match any of the specified regular expressions.\n\n### `-E` or `--exportDefault`\n\nAlso export the default export of the file. Currently works only with the `flat` mode.\n\n```TypeScript\nexport * from \"./barrel\";\nexport { default as barrel } from \"./barrel\";\n```\n\n### `-F` or `--fullPathname`\n\nexportDefault with full pathname to create distinct name. Currently works only with the `flat` mode and exportDefault flag.\n\n```TypeScript\nexport * from \"./example/of/the/path\";\nexport { default as exampleOfThePath } from \"./example/of/the/path\";\n```\n\n### `-h` or `--help`\n\nDisplays help information on the command line arguments that barrelsby accepts.\n\n### `-i [regex...]` or `--include [regex...]`\n\nOnly include files whose paths match any of the specified regular expressions.\n\n### `-l [mode]` or `--location [mode]`\n\nThe mode that barrelsby should use to determine where which directories to create barrels in.\nDefaulted to *top*.\n\n- `top` only creates a barrel in the target directory.\n- `below` creates a barrel in every directory just below the target directory.\n- `all` creates a barrel in every directory below (and including) the target directory.\n- `replace` only creates barrels in directories where one already existed.\n- `branch` creates a barrel in every directory that contains other directories.\n\n### `-L` or `--local`\n\nEnable this to prevent barrels including modules that exist in the same directory, rather\nthan recursively searching child directories.\n\n### `-n [name]` or `--name [name]`\n\nSpecifies the name to use for creating new barrels (and identifying old ones). `.ts` wil be\nappended if not included in the name. Barrels names will be defaulted to `index.ts`.\n\n### `-s [mode]` or `--structure [mode]`\n\nThe structure that barrelsby should create inside the barrels. Defaulted to *flat*.\n\n#### `flat`\n\nExports modules without any nesting.\n\n```TypeScript\nexport * from \"./barrel\";\nexport * from \"./index\";\nexport * from \"./directory2/script\";\nexport * from \"./directory2/directory4/deeplyNested\";\nexport * from \"./directory3/program\";\n```\n\n#### `filesystem`\n\nExports modules as a nested structure that matches the file system directories.\n\n```TypeScript\nimport * as barrelts from \"./barrel\";\nimport * as directory2directory4deeplyNestedts from \"./directory2/directory4/deeplyNested\";\nimport * as directory2scriptts from \"./directory2/script\";\nimport * as directory3programts from \"./directory3/program\";\nimport * as indexts from \"./index\";\nexport {barrelts as barrel};\nexport const directory2 = {\n  directory4: {\n    deeplyNested: directory2directory4deeplyNestedts,\n  },\n  script: directory2scriptts,\n};\nexport const directory3 = {\n  program: directory3programts,\n};\nexport {indexts as index};\n```\n\n### `-q` or `--singleQuotes`\n\nUse 'single quotes' in the generated barrel files instead of the default \"double quotes\".\n\n### `-S` or `--noSemicolon`\n\nOmit semicolons from the end of lines in the generated barrel files.\n\n### `-H` or `--noHeader`\n\nOmit adding a header comment to the top of the barrel file.\n\n### `-v` or `--version`\n\nDisplay the barrelsby version number.\n\n### `-V` or `--verbose`\n\nDisplay additional debug information.\n\n## Requirements\n\nRequires node v6.0.0 or greater for ES6 syntax.\n\n## Contributing\n\nSee CONTRIBUTING.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbencoveney%2Fbarrelsby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbencoveney%2Fbarrelsby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbencoveney%2Fbarrelsby/lists"}