Is it ok to have multiple .json packages in a project?

Is it possible to have multiple package.json projects in a project? I am working on a .NET MVC solution and has package.json at the root level. I need to integrate Jasmine / Karma into a solution and this is my first time doing this type of integration. I found a sample project for Jasmine / Karma on the internet and I was able to run it locally. This project has its own package.json package.

It seems like it would be useful to keep the package.json file for the Jasmine / Karma sample separate from the package.json at the root of the solution to provide more flexibility and allow the same properties to be used in different ways based on context.

Would this be fair or even considered common practice? Or do I need to figure out how to merge the package.json content from the sample project into package.json at the root level of the .NET MVC solution?

+3


source to share


2 answers


I would say its typical bad practice to have more than one .json package. I would only expect npm to have to be installed once, and dealing with two sets of dependency management can lead to problems down the line.



+3


source


From a simple storage perspective, it is easiest to maintain only one file package.json

, but there is nothing inherently wrong with multiple files package.json

in the repo. Some companies use mono repositions for which it would make sense to have multiple files package.json

.



Multiple files package.json

give you more flexibility to run different / incompatible versions of dependencies. As a practical example, in one of the projects I'm working on, we have 2 package.json

files, one for the main application code, and then another for our BDD tests. We are using chimpanzees for our BDD tests and have problems running in the latest version of node, whereas we do not want the rest of the application to update just because of this. We also found that the single file was package.json

very confusing when it was first combined.

+1


source







All Articles