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

Restricted Project Naming #1728

Closed
coopbri opened this issue Aug 15, 2022 · 12 comments
Closed

Restricted Project Naming #1728

coopbri opened this issue Aug 15, 2022 · 12 comments
Labels
good first issue Good for newcomers help wanted Contributions encouraged priority:low

Comments

@coopbri
Copy link

coopbri commented Aug 15, 2022

Description

When creating a new Gleam project with gleam new, there are situations where the gleam CLI will respond with errors due to disallowed project naming patterns:

Context: based on this Twitter thread

Ideas

  1. Document this in the getting started guide/docs (may be a good temporary fix)
    • Mention reserved keywords situations (gleam prefix) as well as underscore convention
  2. Combine the error messages (though might be too much output to the user)
  3. Allow more project naming patterns; decouple Gleam project names from their parent folder name, allowing project directory names such as gleam-demo, gleam, and gleam_demo
    • I like this idea the most of the three proposed here; this is allowed in, for example, a new Rust/Cargo project. You can create projects with analogous name rust-demo, rust, and rust_demo:

Let me know if you have other ideas. I'm happy to take this on after a consensus is reached!

@lpil
Copy link
Member

lpil commented Aug 15, 2022

Thanks for the report, this must have been very annoying.

I would suggest that in these instances we could print something like this

"We were not able to create your project as gleam as etc etc....

Would you like is to create a project named my_gleam in a directory named gleam? (Y/n)"

decouple Gleam project names from their parent folder name, allowing project directory names such as gleam-demo, gleam, and gleam_demo

This is already the case! Unfortunately we take the project name as the argument here and use the director name as the same.

@lpil lpil added help wanted Contributions encouraged area:tooling labels Aug 15, 2022
@inoas
Copy link
Contributor

inoas commented Aug 15, 2022

Maybe instead of saying what it should not be it should say what it should be:

Maybe fully formulating what the project name must be helps?

Like:

Project name must be lowercase, alphanumeric, may not start with a number and may not be named gleam or begin with gleam_.

@coopbri
Copy link
Author

coopbri commented Aug 22, 2022

Thanks for the report, this must have been very annoying.

I would suggest that in these instances we could print something like this

"We were not able to create your project as gleam as etc etc....

Would you like is to create a project named my_gleam in a directory named gleam? (Y/n)"

decouple Gleam project names from their parent folder name, allowing project directory names such as gleam-demo, gleam, and gleam_demo

This is already the case! Unfortunately we take the project name as the argument here and use the director name as the same.

Not annoying at all! No worries.

I think coupling the solution from @inoas with the automated (Y/n) prompt suggested by @lpil might be a nice approach. Basically conveying all of the restrictions in one go while also automating a suggested project name.

@lpil
Copy link
Member

lpil commented Aug 22, 2022

Fab, I agree. Let's do it

@lpil
Copy link
Member

lpil commented Jan 23, 2023

The solution: make it suggest an alternative name. The full list of problems could be suggested in the text also, though the main problem would need to be presented first and foremost as today.

@Davidjustice28
Copy link

@lpil Would be okay if I tackle this issue? I have been a developer for a over a year now, but for some reason, I have been intimidated in tackling a truly open source project. I am super excited about gleam and would like the language to be my first open source project to start contributing to. This would be a good first issue to stretch my legs.

@lpil
Copy link
Member

lpil commented Mar 19, 2024

Yes please! That'd be great. Do ask any questions if you have any while working on it.

@Tar-Tarus
Copy link
Contributor

Hey @lpil ,
I've been working on #3395 and this issue here seemed close enough to tackle next.
I've already started hacking around for a solution, would it be alright to take this up?
I also have some initial questions but I guess it would be best to ask those in a PR when the code suggestion can be checked out in context as well...

@lpil
Copy link
Member

lpil commented Jul 19, 2024

Great! Yes please @Tar-Tarus !!

@diemogebhardt
Copy link
Contributor

I had a look into it in PR #3913.

@diemogebhardt
Copy link
Contributor

This issue might be closed now by having merged PR #3913, @lpil?

@lpil
Copy link
Member

lpil commented Feb 2, 2025

Thank you!!

@lpil lpil closed this as completed Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Contributions encouraged priority:low
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants