Closed khwgit closed 1 year ago
Hi @drinkmorecola! Thanks for opening an issue 👋🏼!
There's the option GDBF: Current with subfolders
. I have now seen that it is not documented in the readme!
Could you try it and see if it helps?
Thanks for the support!
I'm closing the issue now as I'm not receiving any response! The option I have proposed it should produce the output you are looking for.
If there's any issue, reopen the issue!
Sorry for late reply. That result is a bit different from what I’m expecting. The generated file is in the target folder (E.g. the path of generated file in the example is ../models/models.dart
), but I want the path to be ../models.dart
, which means the models.dart
is out of the models
folder. They should be at the same level.
Just something that I do not understand from your example: course.dart
and user.dart
are files or folders? The /
at the end makes it confusing as normally folders are ended with the dash.
The thing is that I don't understand how the files are structured. Can you use this tool to generate the file tree?
🙈they are files. Here’s the correct example.
models/
course.dart
user.dart
models.dart
So models.dart
is outside the models/
folder?
Yes that’s what I mean.
Does the models
folder have a parent component?
If so, you can do:
true
the dartBarrelFileGenerator.promptName
. This will display an input when you are generating a barrel file.models
in this case).It should generate a barrel file outside the models/
folder with the models.dart
name.
Would that help you?
If there are more than one folders, for example
models/
course.dart
user.dart
services/
service.dart
The generated models.dart
will export files under services
too, which is unexpected.
Yes, it will. I'm planning on also adding a feature that would allow you to exclude folders. As of now this is not possible.
I'm sorry but what you are asking for it is really complex to do, and I'm currently not with enough time to do it. I also have the feeling that this is a really ad-hoc case, so I would need to find a solution for many specific cases, therefore implementing complexity in the code. 🙏🏼
Nonetheless, I would not recommend having barrel files outside the folder from they should be exported, as this breaks with the idea of why they exist.
I will close the issue but I will keep the idea in mind. Maybe if I have time enough I will try to find a solution...
Really appreciate your patience!
Could it be possible to have the generated file like this?
This structure can make the import paths look better.
Btw this extension is really helpful to organise the files, especially in a big project. Nice work!