NodeOS / nodeos-usersfs

2 stars 7 forks source link

Architectural motivation behind keeping deps in .txt vs package.json #1

Closed dbkaplun closed 9 years ago

dbkaplun commented 9 years ago

What was the architectural motivation behind keeping deps in .txt vs package.json? Just curious. Maybe we should keep deps in package.json instead?

piranna commented 9 years ago

Good point ;-)

The reason is due because npm don't walk over the tree of already installed dependencies (or bundledDependencies, that's the same for this matter), so using a .txt file I can be able to parse it and call npm myself on the layers and install them wherever I want. Another alternative would be to have a "nodeosDependencies" entry on the package.json, but it's the same for this matter.

The reasons of having bundleDependencies is because the championship only take in account one repository, and also, because npm dependencies can be installed in any order, so the cross-compiler would not be ready for the other ones. Upcoming npm multi-stage install and auto-dedupe of packages would fix this, because the cross-compiler would be set as a dependency of all the layers but only installed once (imagine creating the cross-compiler once for each layer!!! :-P)

The idea is to use package.json and there's an initial work, but it's not working due to the npm random install order :-( But definitely it will be done this way when auto-dedupe is available on npm@3 :-)

dbkaplun commented 9 years ago

:+1: great explanation.

piranna commented 9 years ago

Thank you! ^^