mantrajs / mantra-cli

Command line interface for building Meteor apps with Mantra
MIT License
135 stars 34 forks source link

add moduleName to template-variables #79

Closed macrozone closed 8 years ago

macrozone commented 8 years ago

I want to create generators for storybook-stories in components.

A story begins with storiesOf('module_name.ComponentName', module)

so we need the module name available as template-variable.

This PR introduces these template-variables for components and stories.

Some things to discuss:

moduleName: CamelCaseModul moduleFileName: snake_case_modul

sungwoncho commented 8 years ago

However, some generators do not have a moduleName (collections and publications), so this parameter is null there, which is a little bit ugly.

Good point. We can pass an object instead of relying on the order of the arguments.

i.e. Something like getTemplateVaraibles({ type, moduleName, fileName }, options = {}).

We can refactor using object parameters in the long run.

i think we can merge the two functions getTestTemplateVaraibles and getTemplateVaraibles

I agree. Maybe this can be done in a separate PR.

Is this PR in conjunction with #80, or can it be merged separately?

macrozone commented 8 years ago

@sungwoncho

Is this PR in conjunction with #80, or can it be merged separately?

can merge separatly, i did not use it yet in the other PR :)

sungwoncho commented 8 years ago

Okay let's sit on it for the time being because the two are related. If merging this will make your life easier let me know.

macrozone commented 8 years ago

yep, merging would be easier!

sungwoncho commented 8 years ago

@macrozone Just merged.

macrozone commented 8 years ago

@sungwoncho awesome, use it already in the other PR