lb4 relation doesn't find models
Describe the bug
I have a project with a lot of models. I organized the models in "sub directories" inside "models" directory. The "export" is working properly and all the project is working. What is not working is the possibility to add repositories, relations or anything else "lb4 relation" stops with an error "Generation is aborted: Error: No models found in ".../src/models"." I expect the script to be capable to look for models also inside according to what is available in "index.ts" from "models" directory.
Logs
No response
Additional information
No response
Reproduction
https://github.com/danysz/demo-lb4-cli-model-not-found
This is the error that the CLI gives:
$ lb4 relation
? Please select the relation type belongsTo
No change to package.json was detected. No package manager install will be executed.
Generation is aborted: Error: No models found in C:\Users\Ben\Documents\dev\sandbox\demo-lb4-cli-model-not-found\src\models.
Please visit https://loopback.io/doc/en/lb4/Model-generator.html for information on how models are discovered
Visiting the page provided doesn't actually give any information about how models are discovered.
This is the error that the CLI gives:
$ lb4 relation ? Please select the relation type belongsTo No change to package.json was detected. No package manager install will be executed. Generation is aborted: Error: No models found in C:\Users\Ben\Documents\dev\sandbox\demo-lb4-cli-model-not-found\src\models. Please visit https://loopback.io/doc/en/lb4/Model-generator.html for information on how models are discoveredVisiting the page provided doesn't actually give any information about how models are discovered.
Exactly and even more there Is no way I can make it to look in the subdirectories. Which means that if I am using 100 models for different purposes all of them should be in the same directory.
@loopback/boot is able to find artifacts in nested folders. I wonder if same type of artifact discovery could be used for @loopback/cli to find models/repositories in nested folders.
I confirm lb4 is not able to find models in subdirectory. Not really a bug, but a nice to have feature.
I confirm lb4 is not able to find models in subdirectory. Not really a bug, but a nice to have feature.
It could definitely make organization a lot easier as a service grows.