Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider barrel files in recursive folders #4

Open
apollox opened this issue Sep 6, 2024 · 2 comments
Open

Consider barrel files in recursive folders #4

apollox opened this issue Sep 6, 2024 · 2 comments

Comments

@apollox
Copy link

apollox commented Sep 6, 2024

Is it possible to extend the feature of recursive folder detection, that it also consider existing barrel files in the recursive folders?
This would simplify the barrel files, especially in higher hierarchy levels and there are less file changes in a commit because only the nearest existing index.ts would be change with the command Update Barrel and not all in the folder tree.

Example structure

  • shared
    • index.ts
    • model
      • index.ts
      • user.ts
      • person.ts
      • address.ts
    • service
      • index.ts
      • user.service.ts
      • person.service.ts

Current 'shared/index.ts'

export * from './model/address';
export * from './model/person';
export * from './model/user';
export * from './service/person.service';
export * from './service/person.service';

Current 'shared/model/index.ts'

export * from './address';
export * from './person';
export * from './user';

Expected 'shared/index.ts'

export * from './model';
export * from './service';
@ManuelGil
Copy link
Owner

Hi @apollox,

Apologies for the delay.

I've been looking into the development of this new feature, but I don't see a straightforward path to implementing it. The challenge lies in handling file searches recursively, which would add complexity to the code. This could also introduce unintended side effects, especially for projects using frameworks like Next.js.

Currently, there's already a configuration option (autoBarrel.files.disableRecursiveBarrelling), that manages recursion. However, implementing this feature would require adding a new setting to toggle between these configurations.

Given the potential complications and time constraints, I regret that I’m unable to commit to delivering this update at the moment. As an alternative, I recommend exploring other extensions that might meet your needs.

Thank you for your understanding.

@thaoula
Copy link

thaoula commented Feb 21, 2025

Hi @apollox,

I was just about to raise this as an issue.

I was looking at the exports the extension currently generates when asking it to create a barrel for a folder with nested folders and found that it generates an export for file except for index files.

How do you exclude the index files in your search, you must be encountering them and throwing them away, can we just throw away the other files and take the index file (if enabled by a feature flag)

Kind Regards,
Tarek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants