wasp-lang / wasp

The fastest way to develop full-stack web apps with React & Node.js.
https://wasp-lang.dev
MIT License
13.31k stars 1.18k forks source link

Validate `tsconfig.json` and `package.json` #2169

Open infomiho opened 2 months ago

infomiho commented 2 months ago

Sub issues

Added by @sodic:

Backstory

While developing Wasp's support for schema.prisma file we agreed that it's best if we let users write whatever they want inside and we take it as the source of truth (as opposed to injecting config values on the fly which users don't see). This made sense since the users saw the config Wasp actually uses. Of course, we had to introduce validation for some fields Wasp depended on e.g. the url field has to be env("DATABASE_URL") - the compiler throws an error if it isn't that value.

Idea

Since Wasp doesn't generate the tsconfig.json or the package.json but instead it uses the files as-is, Wasp apps can break if users change the config in weird ways or the config file can become outdated with the latest versions of Wasp. For example, if we figure out the new best values for the tsconfig.json then the user should update that file manually. If they don't, they have a broken IDE experience but Wasp compiler doesn't warn the user about it.

We should introduce some validation of the tsconfig.json and the package.json files:

This way we are ensuring prerequisites for the Wasp app to run successfully and making the whole dev experience more robust. Users will know if they mess something up since the compiler will tell them.

Martinsos commented 2 months ago

This sounds like the right way, great!