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

[feature]: add format process on generate command #1112

Closed
akifarhan opened this issue Jun 26, 2024 · 7 comments · Fixed by Stacked-Org/cli#47
Closed

[feature]: add format process on generate command #1112

akifarhan opened this issue Jun 26, 2024 · 7 comments · Fixed by Stacked-Org/cli#47
Labels
Improvement An issue to improve existing functionality

Comments

@akifarhan
Copy link
Contributor

Is your feature request related to a problem? Please describe.

No response

Describe the solution you would like

Introduce a formatting process for the stacked generate command to ensure the generated files adhere to the user-defined line length. This enhancement aligns the behaviour of the stacked generate command with the stacked create command, which already formats files according to the specified line length.

Additional Context

Related links:
PR
Discussion

@FilledStacks FilledStacks added the Improvement An issue to improve existing functionality label Jun 27, 2024
@FilledStacks
Copy link
Contributor

Thanks for adding the issue @akifarhan

@ferrarafer
Copy link
Contributor

@akifarhan @FilledStacks I'm not sure of this feature, generated code is not intended to be read and, because of that, I don't see why it should respect the format style of the project. The generated code could be obfuscated, which should not be a problem for us.

It is just an opinion, what do you think of this?

@akifarhan
Copy link
Contributor Author

Thank you for the feedback @ferrarafer . I understand that generated code is primarily intended for functionality rather than readability. However, I have some concerns regarding the current behaviour:

  1. Existing behaviour in stacked create app: The stacked create app command includes a dart format step to format files according to the specified line length. This indicates an intention to ensure the newly created files follow the project's formatting guidelines including the generated code.

  2. Consistency: When I run the stacked generate command, I encounter unnecessary file changes where the generated code doesn't adhere to the specified line length. This inconsistency requires manual dart format in the development workflow to indicate that there's no changes to the generated code except for the styling format, which can be cumbersome

I believe integrating a formatting step into the stacked generate command would enhance the overall developer experience and maintain consistency across the codebase.

@ferrarafer
Copy link
Contributor

@akifarhan I will tackle this improvement next week.

@akifarhan
Copy link
Contributor Author

Thank you @ferrarafer ! Appreciate it. I would like to contribute and I've already created a PR but am having difficulties testing it locally.

I've tried this:
dart pub global activate --source path .

But received this error whenever I tried to run stacked commands.
FormatException: Could not parse ""/Users/akif/development/packages/stacked-org/cli"".

I appreciate it if you could help me to test it locally.

@ferrarafer ferrarafer linked a pull request Jul 1, 2024 that will close this issue
@ferrarafer
Copy link
Contributor

ferrarafer commented Jul 1, 2024

Hi @akifarhan, I just saw the message and already pushed the PR.

To test the changes locally I usually do the following:

dart bin/stacked.dart generate

Take into account the example above suppose you are at the root of the project of the cli package. If not, adapt the path for the bin folder to your needs.

@FilledStacks
Copy link
Contributor

@akifarhan this has been merged into the cli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement An issue to improve existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants