francescov1 / mongoose-tsgen

A plug-n-play Typescript generator for Mongoose.
102 stars 24 forks source link

Add support for nested models folder #126

Closed horvbalint closed 1 year ago

horvbalint commented 1 year ago

In this short PR we added support for nested models folders. This would allow models inside a structure like this, to be recognized:

models/
    | subfolder1
        | model1.ts
    |subfolder2
        | model2.ts
    |model3.ts
francescov1 commented 1 year ago

Hey @horvbalint, thanks for submitting. I avoided doing this since it can make file search very slow in certain cases. Instead, you can simply provide that pattern yourself as the first argument to the CLI:

mtgen "modelsFolder/**/*.ts"

Also note that if you don't provide a first argument (eg just run mtgen alone) it will search for subdirectories, so this is another way to do it.

Closing for now, feel free to re-open if there are any issue with this