meanjs / generator-meanjs

MEAN.JS Official Yeoman Generator
http://meanjs.org/
473 stars 178 forks source link

Generator not pluralizing module names properly #205

Open jamviking opened 8 years ago

jamviking commented 8 years ago

grunt failed in tests/server/routes.test on module named "party" being pluralized as "partys" and "parties" at line 89.

        // Get a list of Parties
        agent.get('/api/parties')
          .end(function (partysGetErr, partysGetRes) {
            // Handle Party save error
            if (partysGetErr) {
              return done(partysGetErr);
            }

            // Get Parties list
            var parties = partiesGetRes.body;

            // Set assertions
            (parties[0].user._id).should.equal(userId);
            (parties[0].name).should.match('Party name');

            // Call the assertion callback
            done();
          });
codydaig commented 8 years ago

Which sub generator is producing this?

jamviking commented 8 years ago

meanjs:crud-module

On Mon, Mar 7, 2016 at 10:51 AM, Cody B. Daig notifications@github.com wrote:

Which sub generator is producing this?

— Reply to this email directly or view it on GitHub https://github.com/meanjs/generator-meanjs/issues/205#issuecomment-193310036 .

Ariestattoo commented 8 years ago

This is a result of the underscore.inflections module in the crud module index.js

  this.name = props.name;
  this.slugifiedName = s(this.name).slugify().value();

  this.slugifiedPluralName = inflections.pluralize(this.slugifiedName);
  this.slugifiedSingularName = inflections.singularize(this.slugifiedName);

Inflections does have support for adding irregular words, however I have added it in several places including the global modules for the generator and it does not seem to take which may be my misunderstanding of how the generator works.

jamviking commented 8 years ago

I think I found the bug in the server route tests template...How do i go about creating a pull request for the fix (am a git/javascript newbie)?

jamviking commented 8 years ago

I figured how to create the PR...just one silly mistake...did not create a branch for the fix first..

keithics commented 8 years ago

@Ariestattoo Other than irregular words, it is only limited to English language.

i think it's better to have an option to choose the plural and singular term for each module. And we will use the inflections as a default.