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

improvement: Improve genezio addClass output #919

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bhavyastar
Copy link

Pull Request Template

Type of change

  • πŸ• New feature
  • πŸ› Bug Fix
  • πŸ”₯ Breaking change
  • πŸ§‘β€πŸ’» Improvement
  • πŸ“ Documentation Update

Description

This PR improves Genezio addClass output

Checklist

  • My code follows the contributor guidelines of this project;
  • I have updated the documentation;
  • I have added tests;
  • New and existing unit tests pass locally with my changes;

@bhavyastar
Copy link
Author

Please review this @andreia-oca

@@ -40,7 +40,9 @@ export async function addClassCommand(classPath: string, classType: string) {
const classExtension = className.split(".").pop();

if (!classExtension || className.split(".").length < 2) {
throw new UserError("Please provide a class name with a valid class extension.");
throw new UserError(
"Please provide a class name with a valid class extension (.ts, .js, or .dart.",
Copy link
Member

Choose a reason for hiding this comment

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

Please, do not hardcode these values here.

We keep adding support for more programming languages and it would be hard to maintain this piece of code if it's harcoded.
You can use and parse these list [1] of supported extensions to form the error message.

[1] https://github.com/Genez-io/genezio/blob/main/src/utils/languages.ts#L2

@andreia-oca andreia-oca linked an issue Mar 27, 2024 that may be closed by this pull request
@bhavyastar
Copy link
Author

Hey @andreia-oca
Can you please review the changes?

Copy link
Member

@andreia-oca andreia-oca left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for your contributions πŸŽ‰

@@ -40,7 +40,9 @@ export async function addClassCommand(classPath: string, classType: string) {
const classExtension = className.split(".").pop();

if (!classExtension || className.split(".").length < 2) {
throw new UserError("Please provide a class name with a valid class extension.");
throw new UserError(
`Please provide a class name with a valid class extension. Currently supporting:${supportedExtensionsString}`,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
`Please provide a class name with a valid class extension. Currently supporting:${supportedExtensionsString}`,
`Please provide a class name with a valid class extension. Currently supporting: ${supportedExtensions}`,

Copy link
Member

Choose a reason for hiding this comment

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

It seems that supportedExtensionsString is not declared, I think you want to use supportedExtensions instead. Feel free to commit my suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Improvement task]: Improve genezio addClass output
2 participants