Closed jonmanga closed 4 years ago
Not totally opposed to merging this in, but what is the use case? I mean, when would this happen?
does this only trim them when filename and dirname match?
for example, if we have /star-wars/starWars.yml
but also /star-wars/get.yml
, will 1 be starWars
and the other get
?
This may be something that should be configurable as opposed to one or the other - for example
{{ autoDefinitionIndexer({ dropBaseName: true }) }}
@p-mcgowan it's only for Models/Definitions. The trim will on act on the first instance. Instead of StartWarsStarWars
you'll get StartWars
in the second case you'll get StarWarsGet
.
I didn't think anyone would want duplicate names in their models that's why I made it mandatory. However, we agreed with @johndcarmichael to make it configurable as you suggested above.
ah cool - yeah that makes sense
Update to use:
{{ autoDefinitionIndexer({ dropBaseName: true }) }}
@jonmanga looks good except to make this easier for 3rd parties to understand and as this is not typescript could you add a jsdoc to the nunjucksHelpers/autoComponentIndexer.js then we can roll it out.
Remove is either a string or an object, but this is not clear unless you chase the code through.
The docs of your new feature needs a few words too on the branch gh-pages: https://github.com/johndcarmichael/boats/blob/gh-pages/README.md#auto-index-files
Given a definition like
/star-wars/StarWars.yml
to output in generated definitions will only beStarWars
instead ofStarWarsStarWars