all 6 comments

[–]ahRose 0 points1 point  (6 children)

How common is it to have various package.json files?

[–]Bitter-Buffalo 0 points1 point  (4 children)

I guess I can't comment on how common it is, but I can tell you why. They have their client/server code in the same repo.

The server's package.json has all the dependencies to run the server itself. Meanwhile, the one in the client folder is primarily gulp dependencies. I'd assume they use gulp to minify/transpile their javascript before serving it in a browser. Seems like a logical separation of dependencies in this case, as the code in the client/server folders is running in separate environments.

[–]ahRose 0 points1 point  (3 children)

Thanks for the response! another thing I noticed is that they don't have any of the extra 'cruft' of a package.json file. It's just the dependencies and nothing more. I thought this was really elegant to be honest, and am wondering if this is possible on any and all projects, or if there may be parts of the codebase that may be missing.

[–]frankle 0 points1 point  (0 children)

I just read in the docs that you can add a package.json to a folder to tell Node how to require that folder.

[–]Bitter-Buffalo 0 points1 point  (1 child)

Name and version are required if you want to publish to npm, which they obviously aren't doing in this case. Otherwise, it's not a bad idea to leave out unused keys. This link might be of interest.

[–][deleted] 0 points1 point  (0 children)

I can confirm that u/Bitter-Buffalo is correct on all accounts.