wasp icon indicating copy to clipboard operation
wasp copied to clipboard

Split dependencies in the new structure

Open sodic opened this issue 1 year ago • 1 comments

[!NOTE] We should do this together with #1841

In the new structure of a Wasp project (see prototype in #1584), Wasp dependencies are split into 4 groups:

  1. Project and user dependencies - listed in /package.json.
  2. SDK dependencies - listed in /node_modules/wasp/package.json.
  3. Server dependencies - listed in .wasp/out/server/package.json.
  4. Client dependencies - listed in .wasp/out/web-app/package.json.

Identify which dependencies belong to which "project" (some dependencies might be required in multiple projects) and modify the generator to output appropriate package.json files.

Also, find a way to let the users know which dependencies in the root package.json they aren't allowed to touch.

sodic avatar Dec 07 '23 14:12 sodic

We've released Wasp 0.12.0 with some separation of dependencies, but we weren't thorough enough.

The issue still stands: figure out what belongs where and remove duplicates and redundancies.

Idea: Why not move all Wasp's dependencies from the user's package.json to the SDK's package.json. The main reasons against doing this were:

  • This packages (e.g., typescript, react) are so crucial to Wasp that they should be listed in the package.json explicitly.
  • What happens if the user (by accident) specifies one of these dependencies themselves? Does it break the app?

Finally, decide which packages can and should be peer dependencies (or dev dependencies).

Especially pay attention to:

  • Types (e.g., @types/react, @types/react-router-dom) - Where should these go? Investigate the implications of putting them into each possible location:
    • user:dependencies vs user:devDependencies vs sdk:dependencies vs sdk:devDependencies.
  • Packages Wasp implicitly needs - Packages that Wasp doesn't list as dependencies, but its code can't work without them (e.g., cors package for configuring middleware, possibley screen package for testing). This is bad API design on our part, and we should figure out what to do with those packages.
  • Core packages - Wasp's core dependencies: React, Typescript, Vite, etc.

sodic avatar Feb 29 '24 15:02 sodic