Skip to content

Instantly share code, notes, and snippets.

@Gozala
Forked from isaacs/case.js
Created November 6, 2012 00:23
Show Gist options
  • Save Gozala/4021511 to your computer and use it in GitHub Desktop.
Save Gozala/4021511 to your computer and use it in GitHub Desktop.
npm testcase
var npm = require("npm")
var path = require("path")
npm.load({ prefix: path.join(process.env.HOME, ".orchestrator") }, function(e, npm) {
npm.commands.ls([], function(err, _) {
// this time it's nothing but probably results are cached
npm.commands.install(["method"], function(err, _) {
// now there is something but it still thinks there is nothing.
npm.commands.ls([], console.log)
})
})
})
> /Users/gozala/.orchestrator
└── (empty)
npm http GET https://registry.npmjs.org/method
npm http 304 https://registry.npmjs.org/method
method@0.1.1 ../../.orchestrator/node_modules/method
/Users/gozala/.orchestrator
└── (empty)
null { dependencies: {},
path: '/Users/gozala/.orchestrator',
realName: undefined,
realPath: '/Users/gozala/.orchestrator',
link: undefined,
depth: 0 } {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment