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

Validate tsconfig.json and package.json #2169

Open
infomiho opened this issue Jul 9, 2024 · 1 comment
Open

Validate tsconfig.json and package.json #2169

infomiho opened this issue Jul 9, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@infomiho
Copy link
Contributor

infomiho commented Jul 9, 2024

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:

  • there should be "wasp": "file:.wasp/out/sdk/wasp" in the package.json
  • "module", "target", "moduleResolution" fields in the tsconfig.json should have certain values
  • etc.

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.

@infomiho infomiho added the enhancement New feature or request label Jul 9, 2024
@Martinsos
Copy link
Member

This sounds like the right way, great!

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

No branches or pull requests

3 participants