{"name":"npm-path","version":"1.0.2","description":"Get a PATH with all executables available to npm scripts.","main":"index.js","bin":{"npm-path":"bin/npm-path"},"scripts":{"test":"faucet"},"author":{"name":"Tim Oxley"},"license":"MIT","devDependencies":{"faucet":"0.0.1","tape":"^4.0.0"},"dependencies":{"which":"^1.1.1"},"directories":{"test":"test"},"repository":{"type":"git","url":"git+https://github.com/timoxley/npm-path.git"},"keywords":["npm","run","executable"],"bugs":{"url":"https://github.com/timoxley/npm-path/issues"},"homepage":"https://github.com/timoxley/npm-path","gitHead":"cf614414bdde419842028dbdbd9e8d404e964a6b","_id":"npm-path@1.0.2","_shasum":"e7f6ecf5e51f8ef972cbaa3b2c29cebc2d69a870","_from":".","_npmVersion":"2.8.3","_nodeVersion":"1.8.1","_npmUser":{"name":"timoxley","email":"secoif@gmail.com"},"maintainers":[{"name":"timoxley","email":"secoif@gmail.com"}],"dist":{"shasum":"e7f6ecf5e51f8ef972cbaa3b2c29cebc2d69a870","tarball":"http://registry-npm.ywwl.com/npm-path/download/npm-path-1.0.2.tgz","integrity":"sha512-FIKePL1aWXqipibCjzrqDQxqSsAymXU/LXP2g215o/jFdo1XrZ1zhG6HFJaje4LLtaezTezPpaSvN04odJo3RQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID0MhP5uP+vVecuEzQDKB6zz8AWv56v/jH2z0CS8ZK3RAiEAmqhESJpzG2R8HHTV84SFwEq6ctb4jRaJhfB/r5zQhL8="}],"size":4799,"noattachment":false,"key":"/npm-path/-/npm-path-1.0.2.tgz"},"readme":"# npm-path\n\n### Get a PATH containing locally installed module executables.\n\n`npm-path` will get you a PATH with all of the executables available to npm scripts, without booting up all of npm(1).\n\n#### `npm-path` will set your PATH to include:\n\n* All of the `node_modules/.bin` directories from the current directory, up through all of its parents. This allows you to invoke the executables for any installed modules. e.g. if `mocha` is installed a dependency of the current module, then `mocha` will be available on a `npm-path` generated `$PATH`.\n* The directory containing the current `node` executable, so any scripts that invoke `node` will execute the same `node`.\n* Current npm's `node-gyp` directory, so the `node-gyp` bundled with `npm` can be used.\n\n## Usage\n\n### Command-line\n\n```bash\n# Prints the augmented PATH to the console\n> npm-path\n# /usr/local/lib/node_modules/npm/bin/node-gyp-bin:.../node_modules/.bin:/.../usr/local/bin:/usr/local/sbin: ... etc\n```\n\nCalling `npm-path` from the commandline is the equivalent of executing an npm script with the body `echo $PATH`, but without all of the overhead of booting or depending on `npm`.\n\n### Set PATH\n\nThis will set the augmented PATH for the current process environment, or an environment you supply.\n\n```js\nvar npmPath = require('npm-path')\nvar PATH = npmPath.PATH // get platform independent PATH key\n\nnpmPath(function(err, $PATH) {\n  \n  // Note: current environment is modified!\n  console.log(process.env[PATH] == $PATH) // true\n  \n  console.log($PATH)\n  // /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/.../.bin:/usr/local/bin: ...etc\n  \n})\n\n// more explicit alternative syntax\nnpmPath.set(function(err, $PATH) {\n  // ...\n})\n```\n\n#### Synchronous Alternative\n\n```js\n\n//  supplying no callback will execute method synchronously\nvar $PATH = npmPath()\nconsole.log($PATH)\n\n// more explicit alternative syntax\n$PATH = npmPath.setSync()\n```\n\n#### Optional Options\n\n```js\nvar options = {\n  env: process.env, // default.\n  cwd: process.cwd() // default.\n}\n\nnpmPath(options, function(err, $PATH) {\n  // ...\n})\n\nnpmPath.setSync(options)\n\n  // ...\n\n```\n\n\n### Get PATH\n\nThis will get npm augmented PATH, but *does not modify the PATH in the environment*.\nTakes the exact same options as `set`.\n\n```js\nnpmPath.get(function(err, $PATH) {\n  console.log($PATH)\n  \n  // Note: current environment is NOT modified!\n  console.log(process.env[PATH] == $PATH) // false\n})\n\n// options is optional, takes same options as `npmPath.set`\nnpmPath.get(options, function(err, $PATH) {\n  console.log($PATH)\n})\n```\n\n#### Synchronous Alternative\n\n```js\n//  supplying no callback will execute method synchronously\nvar $PATH = npmPath.get()\nconsole.log($PATH)\nconsole.log(process.env[PATH] == $PATH) // false\n\n// more explicit alternative syntax\n$PATH = npmPath.getSync()\n\n```\n\n### Options\n\nBoth `set` and `get` take an optional options object, with optional `env` & `cwd` keys.\n\n* Set `options.env` if you wish to use something other than `process.env` (the default)\n* Set `options.cwd` if you wish to use something other than `process.cwd()` (the default)\n\nThere's also a `options.npm` property which you can set if you want `node-gyp` to be sourced from\nan alternative `npm` installation.\n\n### Get the PATH environment variable key\n\n```js\n// windows calls it's path \"Path\" usually, but this is not guaranteed.\nnpmPath.PATH // 'Path', probably\n\n// rest of the world\nnpmPath.PATH // 'PATH'\n\n```\n\n#### Example Usage\n\n```js\nprocess.env[npmPath.PATH] // get path environment variable\n\n// set path environment variable manually\nprocess.env[npmPath.PATH] = npmPath.get()\n\n// set path environment variable automatically\nnpmPath()\n```\n\n### Get the PATH separator\n\n```js\n// windows\nnpmPath.SEPARATOR // ';'\n\n// rest of the world\nnpmPath.SEPARATOR // ':'\n```\n\n## Credit\n\nPath lookup code adapted directly from npm.\n\nThanks to [Jordan Harband](https://github.com/ljharb) for his [hard work](https://github.com/timoxley/npm-path/pulls?q=is%3Apr+author%3Aljharb) adapting this to work on node 0.8.\n\n# License\n\nMIT\n","publish_time":1433961800384,"_cnpm_publish_time":1433961800384,"dist-tags":{"latest":"2.0.4"}}