bencoveney / barrelsby

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Directory doesn't use array value

acmarcel opened this issue · comments

When using a json config and passing an array of values in the directory option from Arguments it just uses the first item of the array, when it should use all root directories defined in the config file.

I'm running into the exact same issue.

Looks like there's a mismatch between what the docs say and what the code actually does:
https://github.com/bencoveney/barrelsby/blob/master/src/index.ts#L23

Could be solved by either:

  • Update the code to reflect the docs as described above - In practice this sounds like just a for loop but I wonder if there's any edge cases to watch out for, like if somebody passes ["dir/", "dir/nested"].
  • Update the docs to reflect the code - where barrelsby would need to be run once for each directory, probably keeping the code simpler.

@acmarcel @jacewardell I don't suppose you have any more information about how you use Barrelsby (like how your project is set up) that could help inform what to do?

commented

@bencoveney I believe you're right. I believe this feature was half-implemented in the master branch and it looks like I didn't fix it in the right way.

I'll work on it this week.

@bencoveney I'm using barrelsby in my NX workspace and need to generate each app and lib's directory. I got around this by just doing barrelsby -d "apps/app1/src/app" && barrelsby -d "apps/app2/src/app"...

commented

This should be resolved in the latest version