{"name":"npm-path","version":"2.0.3","description":"Get a PATH with all executables available to npm scripts.","main":"index.js","bin":{"npm-path":"bin/npm-path"},"scripts":{"test":"faucet && standard *.js test/*.js bin/*.js"},"author":{"name":"Tim Oxley"},"license":"MIT","engines":{"node":">=4.2.0"},"devDependencies":{"faucet":"0.0.1","npm":"^3.10.5","standard":"^7.1.2","tape":"^4.6.0"},"dependencies":{"which":"^1.2.10"},"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":"1fc4d0913921eab480a438acb6cacf18212fa51e","_id":"npm-path@2.0.3","_shasum":"15cff4e1c89a38da77f56f6055b24f975dfb2bbe","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"timoxley","email":"secoif@gmail.com"},"dist":{"shasum":"15cff4e1c89a38da77f56f6055b24f975dfb2bbe","tarball":"http://registry-npm.ywwl.com/npm-path/download/npm-path-2.0.3.tgz","integrity":"sha512-5Z3zcqK2x155uRLXww549OoEy8bldLezdd/pyaCIaDD+RQ0L5ZGkIFI2EXdoSL5tx0fOiZCUfgJUWBJmWaivhg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD/Vuka+wQtG6znCIQFSLgMa4ejuT4iNzpoWq3nOsmbPQIgZtSjo/dhmGWnj6ddQOQzoySNE1vsWHd8VpnvFrSpXVI="}],"size":6231,"noattachment":false,"key":"/npm-path/-/npm-path-2.0.3.tgz"},"maintainers":[{"name":"timoxley","email":"secoif@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/npm-path-2.0.3.tgz_1481673723327_0.30345648783259094"},"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":1481673723574,"_cnpm_publish_time":1481673723574,"dist-tags":{"latest":"2.0.4"}}