mantrajs / mantra-cli

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

should throw an error if the component name is invalid #75

Closed fermuch closed 8 years ago

fermuch commented 8 years ago

I accidentally wrote this:

$ mantra g component travels::distanceTraveled
  create  ./client/modules/core/components/.jsx
  create  ./client/modules/core/components/tests/.js

It should throw an error instead of creating files without a name.

sungwoncho commented 8 years ago

To get names for module and entity, we use this code: let [moduleName, entityName] = name.split(':'); (see here).

I have a suggestion: we can do length check on name.split(':') and return false while validating. https://github.com/mantrajs/mantra-cli/blob/master/lib/commands/generate.js#L32-L45

Would you like to do a PR? Should be a quick one.