a simple package manager
All you need a package manager to do is download your dependencies and stick them in a folder. Packin does just this and understands several meta data formats including package.json and component.json so you can consume a wider selection of dependencies.
Here is a few interesting design decisions:
First install node. Then run:
npm install packin --global
The add command helps you add dependencies to you
./deps.json file. It takes a list of dependencies in their shorthand form. If the dependecy is just a plain word it is assumed to come from npm.org. If it has one slash its assumed to come from github. If it starts with a
. or a
/ then its assumed to be in the local filesystem. All three cases are demonstrated below:
The install command will recursively walk through all dependencies downloading them if necessary as it goes then add symlinks between all of them under the alias each package expects. Thats right you get to deside the names of the packages you consume not the person who wrote it. Also dependency cycles are fine unlike with
npm-install(1). A further difference from
npm-install(1) is that it does have some important configuration options so if you project depends on
packin-install(1) and is going to be published you should document your configuration in a Makefile.
Notice how the second call returns almost immediatly. This is thanks to packins caching mechanism. Also this cache is global, so the first time install of your projects gets faster the more projects you have previously installed with packin.
Iterate through each dependency and query their respective registries for the latest release tag. If the latest one is different from the current one the dep is swapped for the new one.
This is the undo for
install all dependecies of
var install = require'packin';install__dirnamefiles:'package.json''component.json''deps.json'// files to check for dependency datafolder: 'node_modules' // install to __dirname/node_modulesdevelopment: false // don't install development depsproduction: true // install production depsretrace: true // update cached deps; // => Promise<Package>
Package gives you access to your whole dependency graph.