wasp icon indicating copy to clipboard operation
wasp copied to clipboard

Improve support for project names

Open sodic opened this issue 3 years ago • 1 comments

Users can currently name their Wasp project using an arbitrary Wasp identifier:

The project's name must be a valid Wasp identifier:
  - It can start with a letter or an underscore.
  - It can contain only letters, numbers, or underscores.
  - It can't be a Wasp keyword.

However, our users have pointed out that this isn't flexible enough. For example, many people would like to name wasp projects using kebab-case. We should:

  • definitely support kebab case
  • optionally support arbitrary strings

The main problem with allowing arbitrary strings arises because we use the user-provided project name as the name of the application (i.e., to generate the app declaration inside the main.wasp file). We can get around this limitation by "mapping" the project name provided by the user into a valid Wasp identifier (e.g., turning something-like-this into somethingLikeThis). We should only do this for the purposes of Wasp and leave the project directory's name should stay intact.

sodic avatar May 06 '22 13:05 sodic

As a practical solution, we suggested we allow people to input valid Wasp identifiers with - in them. Then, we use such name to create project directory, and to name project in the .wasp, under the app.title field. However, for app <identifier, we use the version of that input where we convert from kebab-case to camelCase by just removing - and capitalizing the letters after it.

So, if user inputs TODO-app, we would create directory TODO-app, and would generate .wasp file with

app TODOApp {
  title: "TODO-app"
  ...
}
...

Martinsos avatar May 06 '22 16:05 Martinsos

Can I take this?

pt2121 avatar Aug 20 '22 18:08 pt2121

@pt2121 Sorry for the late response, the answer is "yes" :). I know see that you've already made a PR.

Great! Will check it out ASAP.

sodic avatar Aug 22 '22 12:08 sodic