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

Unable to start Cloudflare workers project with capital letters in directory name #13

Closed
nmemoto opened this issue Oct 22, 2023 · 4 comments · Fixed by #14
Closed

Unable to start Cloudflare workers project with capital letters in directory name #13

nmemoto opened this issue Oct 22, 2023 · 4 comments · Fixed by #14

Comments

@nmemoto
Copy link
Contributor

nmemoto commented Oct 22, 2023

This may be a minor issue, but I'll share.

I ran the following

$ npm create hono@latest todoAPI
Need to install the following packages:
create-hono@0.3.1
Ok to proceed? (y) y

create-hono version 0.3.1
✔ Using target directory … todoAPI
✔ Which template do you want to use? › cloudflare-workers
cloned honojs/starter#main to /workspaces/*****/todoAPI
✔ Copied project files

After cd todoAPI && npm i , Run the following

$ npm run dev

> dev
> wrangler dev src/index.ts

 ⛅️ wrangler 3.14.0
-------------------

✘ [ERROR] Processing wrangler.toml configuration:

    - Expected "name" to be of type string, alphanumeric and lowercase with dashes only but got
  "todoAPI".

The wrangler.toml generated at this time is as follows

name = "todoAPI"
compatibility_date = "2023-01-01"

.......

I thought it would be better to kebab case and convert all to lower case when replacing by project name from the template.

const rewritten = wrangler.replaceAll(PROJECT_NAME, projectName)

However, I can't use this method when the project name is a non-ascii character or a non-hyphen symbol. Therefore, I think it would be better to dare to do nothing.

@yusukebe
Copy link
Member

@nmemoto

Thank you for raising the issue. This is good point.

@sor4chi any thought?

@sor4chi
Copy link
Contributor

sor4chi commented Oct 22, 2023

Hi, @nmemoto @yusukebe

It is true, if you ask me.
I have an image that many Create CLI converts App name to snake-case and appropriates it to folder name or app name.

How do you think about this plan?

@nmemoto
Copy link
Contributor Author

nmemoto commented Oct 22, 2023

@sor4chi @yusukebe Thanks for confirming.
How about following wrangler?
It looks like the value of name in wrangler.toml that wrangeler generate creates is set here.

The workerName is set here.
Looking at this process, we see that it converts to lowercase and also replaces all invalid characters with hyphens.

I have created a pull request with the above proposal, could you please check it out? #14

@yusukebe
Copy link
Member

Hi @nmemoto !

I've released the v0.3.2 which is including your fix. Great work! Thanks.

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

Successfully merging a pull request may close this issue.

3 participants