Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

npm-run-path

Package Overview
Dependencies
1
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 2.0.0

34

index.js
'use strict';
var path = require('path');
var pathKey = require('path-key');
const path = require('path');
const pathKey = require('path-key');
module.exports = function (opts) {
opts = opts || {};
module.exports = opts => {
opts = Object.assign({
cwd: process.cwd(),
path: process.env[pathKey()]
}, opts);
var prev;
var pth = path.resolve(opts.cwd || '.');
let prev;
let pth = path.resolve(opts.cwd);
const ret = [];
var ret = [];
while (prev !== pth) {

@@ -22,3 +24,17 @@ ret.push(path.join(pth, 'node_modules/.bin'));

return ret.concat(opts.path || process.env[pathKey()]).join(path.delimiter);
return ret.concat(opts.path).join(path.delimiter);
};
module.exports.env = opts => {
opts = Object.assign({
env: Object.assign({}, process.env)
}, opts);
const path = pathKey();
const env = opts.env;
opts.path = env[path];
env[path] = module.exports(opts);
return env;
};
{
"name": "npm-run-path",
"version": "1.0.0",
"version": "2.0.0",
"description": "Get your PATH prepended with locally installed binaries",

@@ -13,3 +13,3 @@ "license": "MIT",

"engines": {
"node": ">=0.10.0"
"node": ">=4"
},

@@ -37,3 +37,3 @@ "scripts": {

"dependencies": {
"path-key": "^1.0.0"
"path-key": "^2.0.0"
},

@@ -43,3 +43,6 @@ "devDependencies": {

"xo": "*"
},
"xo": {
"esnext": true
}
}

@@ -29,5 +29,3 @@ # npm-run-path [![Build Status](https://travis-ci.org/sindresorhus/npm-run-path.svg?branch=master)](https://travis-ci.org/sindresorhus/npm-run-path)

childProcess.execFileSync('foo', {
env: {
PATH: npmRunPath()
}
env: npmRunPath.env()
});

@@ -45,3 +43,3 @@ ```

Type: `string`
Type: `string`<br>
Default: `process.cwd()`

@@ -53,3 +51,3 @@

Type: `string`
Type: `string`<br>
Default: [`PATH`](https://github.com/sindresorhus/path-key)

@@ -60,3 +58,20 @@

### npmRunPath.env([options])
#### options
##### cwd
Type: `string`<br>
Default: `process.cwd()`
Working directory.
##### env
Type: `Object`
Accepts an object of environment variables, like `process.env`, and modifies the PATH using the correct [PATH key](https://github.com/sindresorhus/path-key). Use this if you're modifying the PATH for use in the `child_process` options.
## Related

@@ -70,2 +85,2 @@

MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc