Improve how we handle user's npm deps (by aliasing wasp deps)
We should always specify the same dependencies in {sever,web-app}/package.json and alias them. Wasp code will use our version of the dependencies, while the user's code will use their versions.
Original discussion: https://github.com/wasp-lang/wasp/pull/1602#discussion_r1431438802 .
If I got it right, what we want to do is simplify how we handle npm deps that user specifies in their package.json, especially in relation to npm deps that Wasp brings for its own framework code.
Right now, we check their deps against our deps (in our "framework" code), and then make decisions, like if we are copying them to their package.json, or our package.jsons (in "framework" code), or rejecting them with error, ... .
Instead, we want to alias Wasp npm deps, that way avoid any conflicts, and just normally use user's npm deps.
Also, code in Generator.NpmInstall, and in Generator.NpmDependencies, is currently a bit of a mess, it deserves some refactoring / clearing up, some comments / names might even be wrong due to changes we did quickly to get it working with restructuring changes.
One idea is also not to track npm deps we installed in our special files for logging that, but instead we could just listen for changes in package.json files -> if webapp/package.json file changes, we run npm install for that, if user's package.json changes, we run npm install for that, if server/package.json changes, we run npm install for that. This might require a bit of ugly/complicated wiring though, or possibly ignore some other responsibilities, so we should think about it before going for it.
Source: wasp-lang/wasp