sumup-oss / foundry

A toolkit for building JavaScript & TypeScript applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typescript support for foundry init

oglu opened this issue · comments

Suggested feature

I used init to create a project, where I selected typescript as the language of choice. In the same time, I selected browser and node as execution environments.

When I tried to execute yarn lint, first I got an error about typescript missing and after I fixed that I got the error that tsconfig is not present.

From a short discussion with @felixjung, I got that this is not a bug, but it nevertheless breaks expectations. When I used yarn init the expectations were that foundry would set up everything.

Alternatives

Type the commands by hand.

Potential downsides

No

Thanks for opening the issue. I share the sentiment that this breaks expectations. In certain contexts I would expect Foundry to set up TypeScript to some degree (i.e., a Node.js service). I'm not sure we want to bundle TypeScript with foundry like we do with other tooling dependencies. If we do so, then this also means we need to run tsc through Foundry.

I see several options of dealing with this. From just putting out helpful messages in the logs to installing and running everything through Foundry and taking care of potential conflicts with Next.js etc.. Will need a bit of time to put together a proposal.

@connor-baer, thoughts?

Foundry currently doesn’t handle build configs (such as tsconfig.json webpack.config.js, .babelrc) because these are usually provided by the framework (e.g. Next.js, Create React App) and tend to be quite specific to a project.

@felixjung makes a good point that "vanilla" projects could benefit from a default/base TypeScript config. We could make use of TypeScript's extends config option.

Installing TypeScript (or webpack, babel) is something I don't believe Foundry should do because it ties you to the preinstalled version. Next.js takes a similar approach in that it requires users to install TypeScript themselves.

My main takeaway from this issue is that as a first step we need to manage expectations through better documentation and logs. Thank you for the feedback! 🙌