Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix generate:model --plugin path + little refacto of code #5547

Merged
merged 4 commits into from Mar 23, 2020

Conversation

petersg83
Copy link
Contributor

fix #3889

Description of what you did:

  • changed path
  • refacto in every strapi-generate-* to use similar code

Signed-off-by: Pierre Noël <pierre.noel@strapi.io>
@codecov
Copy link

codecov bot commented Mar 19, 2020

Codecov Report

Merging #5547 into master will increase coverage by 0.00%.
The diff coverage is 17.85%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #5547   +/-   ##
=======================================
  Coverage   17.50%   17.51%           
=======================================
  Files         700      700           
  Lines       10332    10322   -10     
  Branches     1688     1686    -2     
=======================================
- Hits         1809     1808    -1     
+ Misses       7090     7083    -7     
+ Partials     1433     1431    -2     
Flag Coverage Δ
#front 12.88% <ø> (ø)
#unit 37.40% <17.85%> (+0.13%) ⬆️
Impacted Files Coverage Δ
packages/strapi-generate/lib/generate.js 15.68% <0.00%> (ø)
...er/services/schema-builder/content-type-builder.js 10.98% <30.00%> (+0.11%) ⬆️
...ugin-content-type-builder/services/ContentTypes.js 21.12% <100.00%> (ø)
...ilder/services/schema-builder/component-builder.js 13.72% <100.00%> (ø)
packages/strapi-utils/lib/index.js 100.00% <100.00%> (ø)
packages/strapi-utils/lib/stringFormatting.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce7db06...ea77e6c. Read the comment docs.

Copy link
Member

@alexandrebodin alexandrebodin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions:

  • Why replace deburr by camelCase ? I think this might break when trying to use invalid chars.
  • Why use camelCase for the folder names? Why not leave it to the user like before ?
  • I think we should move away from the upperFirst(camelCase(x)) formatting for the model filename as we do not generate them like this anymore :)

@petersg83
Copy link
Contributor Author

Thanks !

  • You're right, I can add deburr. I replaced it to do exactly like in strapi-generate-api where name is used instead of directly scope.id.
  • Same as above, to do like in strapi-generate-api
  • I'm would be glad to talk about it. How is the naming supposed to be? Many things were inconsistent depending on the package so I'll be happy to establish which one is the good way

Copy link
Member

@alexandrebodin alexandrebodin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice try but strapi-utils isn't client-side friendly ;)

Pierre Noël added 2 commits March 23, 2020 10:42
Signed-off-by: Pierre Noël <pierre.noel@strapi.io>
Signed-off-by: Pierre Noël <pierre.noel@strapi.io>
@petersg83 petersg83 force-pushed the fix/#3889/wrongPathGenerateModelInPlugin branch from d919c35 to 74625b0 Compare March 23, 2020 10:32
@alexandrebodin alexandrebodin added source: core:strapi Source is core/strapi package issue: bug Issue reporting a bug labels Mar 23, 2020
@alexandrebodin alexandrebodin added this to the 3.0.0-beta.19.4 milestone Mar 23, 2020
Copy link
Member

@alexandrebodin alexandrebodin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@alexandrebodin alexandrebodin merged commit c55c94c into master Mar 23, 2020
@alexandrebodin alexandrebodin deleted the fix/#3889/wrongPathGenerateModelInPlugin branch March 23, 2020 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Issue reporting a bug source: core:strapi Source is core/strapi package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong directory with generate:model --plugin
2 participants