SAFE-Stack / SAFE-template

dotnet CLI template for SAFE project
MIT License
282 stars 88 forks source link

package.json doesn't contain all the required packages. #422

Closed Jason5Lee closed 3 years ago

Jason5Lee commented 3 years ago

I'm using pnpm. When I try to run the generated project, multiple Module not found errors show up. These required packages do not present in package.json but only as the dependences of others. Here is the pnpm explanation of this problem.

theimowski commented 3 years ago

Huh, that means we'd need to put more than 700 dependencies into package.json - I doubt we wanna do that. @Zaid-Ajaj @MangelMaxime have you heard of pnpm? Is there any other solution to the outlined problem?

MangelMaxime commented 3 years ago

Hello, I heard of it and never used it.

I find their idea of how to manage the npm modules interested but in the end as you said it would means pulling a LOT of dependencies into the package.json and for me it just looks like manually handling the dependencies...

I think that SAFE-Template made the choice in v2 to simplify the templates and only support npm out of the box. For example, I don't see an arguments for yarn anymore.

I think like for yarn the user when he wants to use pnpm he will need to adapt the project. For yarn, it simply means deleting package-lock.json and running yarn install. For pnpm it requires more work :shrug:

Jason5Lee commented 3 years ago

Huh, that means we'd need to put more than 700 dependencies into package.json - I doubt we wanna do that. @Zaid-Ajaj @MangelMaxime have you heard of pnpm? Is there any other solution to the outlined problem?

Maybe my description was not clear. You don't need to put every package from package-lock.json . But you need to make sure every package that is imported present in package.json . When using npm you can not only import packages in package.json but also their dependencies, which may result in silly bugs.

olivercoad commented 3 years ago

Hmm I see what you mean. That actually makes a lot of sense. Do you have a list of the specific package(s) that should be added to package.json?

Jason5Lee commented 3 years ago

As I know the following packages are enough. 'jsan' 'object-assign' 'rn-host-detect' 'scheduler' 'socketcluster-client' 'ag-channel' 'ag-request' 'async-stream-emitter' 'clone-deep' 'linked-list' 'sc-errors' 'sc-formatter' 'stream-demux' 'uuid' 'consumable-stream' 'is-plain-object' 'kind-of' 'shallow-clone' 'writable-consumable-stream'

kerams commented 3 years ago

I still don't get this. Why would you need to include transitive dependencies (i.e. those that you don't use directly) in package.json?

And I don't know what you're trying to say here:

You don't need to put every package from package-lock.json . But you need to make sure every package that is imported present in package.json

Jason5Lee commented 3 years ago

I still don't get this. Why would you need to include transitive dependencies (i.e. those that you don't use directly) in package.json?

And I don't know what you're trying to say here:

You don't need to put every package from package-lock.json . But you need to make sure every package that is imported present in package.json

These packages ARE used directly. Npm just allows you to directly import the dependencies of the dependencies, which is considered not a good design by pnpm.

kerams commented 3 years ago

Where in the template do you use any of the packages listed above?