Puddi is a node.js library for dependencies managing, made for people who hate managing them.
It works by adding a single raw file for each module, which describes its internal specificities.
To install puddi, a simple
npm install puddi should be sufficient.
The file is encoded using the YAML syntax. (JSON is great, but not really human- readable.)
module:name: my_moduledepends:- other_module- another_module.child_module
We have four modules here. The structure module, which will contain our shared data structures, the modules for both the client and the server and, lastly, the main application module.
Using puddi, our file hierarchy will become :
The structures module doesn't depend on anything, but the client and the server modules both depend on the structures module, and the application module depends on both the client and the server modules.
So this is what the module.yml file should be like :
module:name: applicationdepends:- client- server
module:name: clientdepends:- application.structures
module:name: serverdepends:- application.structures
Note that a module inherits its super module's scope. So instead of
application.structures, we can simply write
structures. It's juste a matter
Now, using puddi, you can simply select the module to resolve (assuming you are in your application directory) :
puddi . application.client --print | xargs -n 1 echo "Client-side application contains this module :" puddi . application.server --print | xargs -n 1 echo "Server-side application contains this module :"
Only the required module and its dependencies will be printed, in a dependencies-aware order.
If, for some reason, one of your folders' name contains a line return, the
output will be broken. In that case, replace
will use a null character as a separator. You will then be able to efficiently
split the output with a command like
xargs with its
What we have done is not fun. Who dares about print some folders path in a specific order ?
But modern shells are powerful. Very powerful. And same is for node libaries !
Using the power of the
xargs, you will be able to execute binaries in a
specific order, and do some magic with it.
For instance (bash file) :
puddi as node.js library
You can obviously use Puddi as a node.js library.
Very simple showcase :
var puddi = ;puddi;