wasp
wasp copied to clipboard
Split dependencies in the new structure
[!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:
- Project and user dependencies - listed in /package.json.
- SDK dependencies - listed in /node_modules/wasp/package.json.
- Server dependencies - listed in .wasp/out/server/package.json.
- 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.
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.jsonexplicitly. - 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:dependenciesvsuser:devDependenciesvssdk:dependenciesvssdk:devDependencies.
- Packages Wasp implicitly needs - Packages that Wasp doesn't list as dependencies, but its code can't work without them (e.g.,
corspackage for configuring middleware, possibleyscreenpackage 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.