honojs / starter

Hono starter templates
59 stars 31 forks source link

Additional Templates using Javascript: Enhancement Suggestion #50

Open NicKAnderson038 opened 1 week ago

NicKAnderson038 commented 1 week ago

This suggestion is based on the continued wide spread use of Javascript. I've been really enjoying the performance and DX of Hono and would love to encourage more people who are hesitant to try Hono.

An example would be a the nodejs template. An update to the cli would prompt Typescript or Javascript like in vite. If selecting Javascript a new template would include the following changes.

  1. package.json { "dev": "node --watch src/index.js" } // The watch flag is available by node 18 which is also the earliest version of node usable by Hono.

  2. jsconfig.json // type inference support

Vite screenshot

Screenshot 2024-09-21 at 3 11 07 PM Screenshot 2024-09-21 at 3 11 34 PM
yusukebe commented 1 week ago

Hi @NicKAnderson038

This is an interesting proposal. But I don't agree with the "JavaScript" in the starters. Hono is based initially on TypeScript (though we started to create Hono with JavaScript and JSDoc in the early phase). TypeScript is okay because the target runtime/platforms are Cloudflare Workers/Pages, Deno, and Bun. With these runtimes/platforms, we don't have to compile it to JavaScript explicitly. And we can use vite/tsx for Node.js, and now there are builders. So, I don't have any chance that I want to write JavaScript instead of TypeScript for the Hono app. I think it's not necessary to support JavaScript templates by making the code more complicated.