bencoveney / barrelsby

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recursive barrels with defaults incorrect create defaults

bruceharrison1984 opened this issue · comments

Trying to use this with a nested structure results in invalid barrels:

export { default as index } from "./components/index";
export * from "./components/index";
export { default as index } from "./hooks/index";
export * from "./hooks/index";

within this intermediate barrel, each index file is named the same thing.
In this case, I would expect * imports, not default imports.

src/
├─ components/
│  ├─ toolbar/
│  │  ├─ index.ts <-- this is generated correctly
│  ├─ button/
│  │  ├─ index.ts
│  ├─ index.ts  <--- this file contains defaults as index

config I used

{
    "directory": "./src",
    "delete": true,
    "location": "all",
    "name": "index",
    "structure": "flat",
    "exportDefault": true,
    "verbose": true,
    "include": [
        "(components|hooks)\/.*.tsx$",
        "(components|hooks)\/.*.ts$"
    ],
    "exclude": [
        ".stories.tsx$",
        ".props.ts$"
    ]
}

I'm just an idiot, further configuration of exclusions solved my issue.