{"id":13847317,"url":"https://github.com/dsherret/barrel-maintainer","last_synced_at":"2025-07-12T08:31:33.388Z","repository":{"id":66053188,"uuid":"115472029","full_name":"dsherret/barrel-maintainer","owner":"dsherret","description":"Automated real-time maintenance of barrels in JavaScript and TypeScript.","archived":true,"fork":false,"pushed_at":"2020-07-17T20:58:21.000Z","size":2139,"stargazers_count":19,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-12T16:15:32.351Z","etag":null,"topics":["automation","code-manipulation","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/dsherret.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}},"created_at":"2017-12-27T02:20:45.000Z","updated_at":"2023-04-20T18:55:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"2b947220-6c31-4946-b200-ec9852bbdd31","html_url":"https://github.com/dsherret/barrel-maintainer","commit_stats":{"total_commits":63,"total_committers":2,"mean_commits":31.5,"dds":"0.015873015873015928","last_synced_commit":"ec2a590f404f05c397b9e47249b3d8fcc9940723"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/dsherret/barrel-maintainer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsherret%2Fbarrel-maintainer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsherret%2Fbarrel-maintainer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsherret%2Fbarrel-maintainer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsherret%2Fbarrel-maintainer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dsherret","download_url":"https://codeload.github.com/dsherret/barrel-maintainer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsherret%2Fbarrel-maintainer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264962222,"owners_count":23689765,"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":["automation","code-manipulation","typescript"],"created_at":"2024-08-04T18:01:16.651Z","updated_at":"2025-07-12T08:31:31.890Z","avatar_url":"https://github.com/dsherret.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Barrel Maintainer\n\n[![npm version](https://badge.fury.io/js/barrel-maintainer.svg)](https://badge.fury.io/js/barrel-maintainer)\n\nAutomatically maintains [barrels](https://basarat.gitbooks.io/typescript/docs/tips/barrel.html) in real-time.\n\n[![Automated real-time barrel maintenance](https://github.com/dsherret/barrel-maintainer/raw/master/demo.gif)](https://youtu.be/gFi7kQnD69k)\n\n[Video Overview](https://youtu.be/gFi7kQnD69k)\n\n## Installation\n\n```bash\nnpm install -g barrel-maintainer\n```\n\n## Usage\n\n```bash\nbarrel-maintainer [options] [path]\n```\n\nOptions:\n\n- `--includeRootDir` - Create a barrel in the root directory.\n- Quote type (specify one)\n  - Defaults to the quote type used in the first found import declaration in your project.\n  - `--singleQuotes` - Use single quotes.\n  - `--doubleQuotes` - Use double quotes.\n- File extension for barrel (specify one)\n  - Defaults to whichever file type your project has more of.\n  - `--ts` - Create index.ts files.\n  - `--js` - Create index.js files.\n- New lines (specify one)\n  - `--crlf` - Use carriage return line feed newlines (default on windows)\n  - `--lf` - Use line feed newlines (default elsewhere)\n\n## Ignoring Files\n\nAdd a `/* barrel:ignore */` statement to the file:\n\n```ts\n/* barrel:ignore */\nexport function log(message: string) {\n    console.log(message);\n}\n```\n\n## Exporting a Subset of a File's Exports\n\nGiven the following setup:\n\n```js\n// classes.js\nexport ClassA {}\nexport ClassB {}\n\n// index.js\nexport * from \"./classes\";\n```\n\nIf you want the barrel to export a subset of the exports from _classes.js_, then edit the barrel to say so:\n\n```js\n// index.js\nexport { ClassA } from \"./classes\";\n```\n\nThese kind of changes won't be overwritten by the code manipulation.\n\n## Api\n\n```ts\nimport BarrelMaintainer from \"barrel-maintainer\";\n\nconst maintainer = new BarrelMaintainer(\"myProject/src/\", {\n    includeRootDir: false,\n    fileExtension: \"js\", // or \"ts\" (extension for barrel)\n    quoteType: \"'\", // or \"\\\"\"\n    newLineType: \"\\r\\n\", // or \"\\n\"\n});\n\nawait maintainer.updateDirectory(\"myProject/src/subdir\");\nconst watcher = maintainer.watchDirectory(\"myProject/src\");\n\n// then later (if necessary)\nwatcher.stop();\n```\n\n## About\n\nThis project uses [ts-morph](https://github.com/dsherret/ts-morph) to navigate and manipulate source code.\n\n## Disclaimer\n\nThis library will modify and delete source code. I am not responsible for any of its modifications or deletions!\n\nAlways use version control to verify and to be able to easily revert the changes it makes!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsherret%2Fbarrel-maintainer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdsherret%2Fbarrel-maintainer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsherret%2Fbarrel-maintainer/lists"}