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

A better default for the application name #37

Open
Kurren123 opened this issue Apr 29, 2020 · 3 comments
Open

A better default for the application name #37

Kurren123 opened this issue Apr 29, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@Kurren123
Copy link

Following from the discussion here:

a nice default for the name would be user_name/dir where dir is the name of the directory containing the elm.json file, as I think this directory is usually a kind of project name

@rlefevre replied with:

The potential issue with that is that sometimes the elm app is in a sub-directory of the project. For example, for one of my Elixir/Phoenix app, the elm application is in assets/elm, so the application would be named my/elm

Thinking about this, maybe if the default is no good you would then specify the name in the application.json? I'm just trying to think of what happens in the majority of cases. I think most of the time the elm.json file sits in the root directory which has a kind of application name. But I think we probably need more opinions here.

Also from @rlefevre:

Another issue is that there are a lot more restrictions on package names that directory names (and the application is transformed to a package before generating the documentation). A lot of characters are forbidden, and a few more rules.

Perhaps we could transform the directory name into something friendly?

@rlefevre rlefevre added the enhancement New feature or request label Apr 29, 2020
@rlefevre
Copy link
Member

rlefevre commented Apr 29, 2020

Note that user names rules are here:
https://github.com/shinnn/github-username-regex

According to the form validation messages on Join Github page,

  • Github username may only contain alphanumeric characters or hyphens.
  • Github username cannot have multiple consecutive hyphens.
  • Github username cannot begin or end with a hyphen.
  • Maximum is 39 characters.

For the module names, they are here:
https://github.com/elm/compiler/blob/38670361cd4b9f9f09621f3f5a7dbe07ebde7bf2/compiler/src/Elm/Package.hs#L316

So from a quick glance:

  • < 256 characters
  • no -- inside
  • no - at the beginning or at the end
  • only lower case
  • no number at the beginning

@rlefevre
Copy link
Member

For user_name/dir, were you thinking about the logged-in user for the user name?
This would make sense.

Apparently, it is be available cross-plaform with:
https://nodejs.org/api/os.html#os_os_userinfo_options.

@rlefevre
Copy link
Member

Perhaps we could transform the directory name into something friendly?

We could indeed, I have put above the restrictions to respect.

I agree that the combination OS_user/current_directory should be more useful than my/application for the large majority of cases.

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

No branches or pull requests

2 participants