Closed letalumil closed 8 years ago
Merged but not published yet. Doing a 3.0 release with a handful fixes.
If I did not convey this before... Super excited for this change. Thank you so, so much for the pr. Gold star for you! :star2:
My pleasure. Thanks for accepting the PR!
Hey @arei, thanks for the great package and I hope this PR will make it even cooler. I needed to create npmboxes from git repositories, the same problem that was described in #44.
I took some inspiration from the npm install.js implementation, where
npm-package-arg
is used to determine what type of package is being installed, andnpm.commands.cache.add
is used to clone a package from a git repository.As you can see from the code, I added 2 more steps between
init
andrack
:extractPackageName
: we can't determine git-based package name until we clone it, so the package is being cloned into the cache directory (that was specified in theinit
step) and then extract package name from thepackage.json
.setTarget
: simply sets value to thetarget
variable and checks if there is no npmbox with this name already on the file system.I also moved nested dependencies gathering into the
lookupPackageDependencies
function in order to reuse it for git and usual packages.These changes solved my pain, but let me know if I can do anything it order to make it better.