infinitered / ignite-bowser

Bowser is now re-integrated into Ignite CLI! Head to https://github.com/infinitered/ignite to check it out.
https://infinite.red/ignite
MIT License
615 stars 140 forks source link

fix model generation adding ModelModel to name #383

Closed absmugz closed 3 years ago

absmugz commented 3 years ago

fix model generation adding ModelModel to name on the following :

export const TestModelModel = types
type ConversationModelType = Instance<typeof TestModelModel>
type ConversationModelSnapshotType = SnapshotOut<typeof TestModelModel>
jamonholmgren commented 3 years ago

@absmugz Thanks for taking a stab at this! It's close -- but what we really want to do here is strip the "-model" if they add it, so that the filename will be correct. We don't actually want to change these files.

For example, if someone does ignite generate model User we don't want it to name these User, we still want UserModel. But we also want it to be UserModel when they do ignite generate model UserModel, not UserModelModel. The easiest way to do that is to strip the final -model or Model from the name argument

Check here: https://github.com/infinitered/ignite-bowser/blob/4d39a91598f8165aa9ebe28b0895a0493aa549a0/src/commands/generate/model.ts#L16-L20

absmugz commented 3 years ago

parameters.first.replace('-model', ''); should do the trick, will revert changes and do that

jamonholmgren commented 3 years ago

@absmugz What if someone makes a ignite g model data-modeling-chart ? Your code will change it to dataing-chart.

jamonholmgren commented 3 years ago

Going to close this in favor of Ignite Flame. Thanks @absmugz !