gleam icon indicating copy to clipboard operation
gleam copied to clipboard

Restricted Project Naming

Open coopbri opened this issue 1 year ago • 7 comments

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!

coopbri avatar Aug 15 '22 00:08 coopbri

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 avatar Aug 15 '22 08:08 lpil

~~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_.

inoas avatar Aug 15 '22 13:08 inoas

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.

coopbri avatar Aug 22 '22 09:08 coopbri

Fab, I agree. Let's do it

lpil avatar Aug 22 '22 17:08 lpil

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.

lpil avatar Jan 23 '23 22:01 lpil

@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.

Davidjustice28 avatar Mar 18 '24 17:03 Davidjustice28

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

lpil avatar Mar 19 '24 10:03 lpil