bencoveney / barrelsby

Automatic TypeScript barrels (index.ts files) for your entire code base

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support to re-export files that are filtered using a module resolution-like behavior (e.g., file extensions)

jgornick opened this issue · comments

Currently, barrelsby allows files to be filtered via a regular expression. However, this is limited when wanting to re-export files with the same name, but different extensions. For example, if I have files component.native.tsx and component.tsx and in my generated barrel file I only want the component.native.tsx file as I'm targeting a "native platform". This is a common use-case for module resolvers where you provide a collection of extensions and the resolver will try each one until it finds a match.

Barrelsby resolution logic is slightly different than a module resolver's logic, but there are some similarities that could allow specific logic to be applied.

Another approach could be to allow a function for include/exclude options that would give the implementer full control over the filtering logic.