aboutsummaryrefslogtreecommitdiff
path: root/node_modules/npm-run-path
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/npm-run-path')
-rw-r--r--node_modules/npm-run-path/index.js39
-rw-r--r--node_modules/npm-run-path/license21
-rw-r--r--node_modules/npm-run-path/node_modules/path-key/index.js13
-rw-r--r--node_modules/npm-run-path/node_modules/path-key/license21
-rw-r--r--node_modules/npm-run-path/node_modules/path-key/package.json39
-rw-r--r--node_modules/npm-run-path/node_modules/path-key/readme.md51
-rw-r--r--node_modules/npm-run-path/package.json45
-rw-r--r--node_modules/npm-run-path/readme.md81
8 files changed, 310 insertions, 0 deletions
diff --git a/node_modules/npm-run-path/index.js b/node_modules/npm-run-path/index.js
new file mode 100644
index 000000000..56f31e471
--- /dev/null
+++ b/node_modules/npm-run-path/index.js
@@ -0,0 +1,39 @@
+'use strict';
+const path = require('path');
+const pathKey = require('path-key');
+
+module.exports = opts => {
+ opts = Object.assign({
+ cwd: process.cwd(),
+ path: process.env[pathKey()]
+ }, opts);
+
+ let prev;
+ let pth = path.resolve(opts.cwd);
+ const ret = [];
+
+ while (prev !== pth) {
+ ret.push(path.join(pth, 'node_modules/.bin'));
+ prev = pth;
+ pth = path.resolve(pth, '..');
+ }
+
+ // ensure the running `node` binary is used
+ ret.push(path.dirname(process.execPath));
+
+ return ret.concat(opts.path).join(path.delimiter);
+};
+
+module.exports.env = opts => {
+ opts = Object.assign({
+ env: process.env
+ }, opts);
+
+ const env = Object.assign({}, opts.env);
+ const path = pathKey({env});
+
+ opts.path = env[path];
+ env[path] = module.exports(opts);
+
+ return env;
+};
diff --git a/node_modules/npm-run-path/license b/node_modules/npm-run-path/license
new file mode 100644
index 000000000..654d0bfe9
--- /dev/null
+++ b/node_modules/npm-run-path/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/npm-run-path/node_modules/path-key/index.js b/node_modules/npm-run-path/node_modules/path-key/index.js
new file mode 100644
index 000000000..62c8250ab
--- /dev/null
+++ b/node_modules/npm-run-path/node_modules/path-key/index.js
@@ -0,0 +1,13 @@
+'use strict';
+module.exports = opts => {
+ opts = opts || {};
+
+ const env = opts.env || process.env;
+ const platform = opts.platform || process.platform;
+
+ if (platform !== 'win32') {
+ return 'PATH';
+ }
+
+ return Object.keys(env).find(x => x.toUpperCase() === 'PATH') || 'Path';
+};
diff --git a/node_modules/npm-run-path/node_modules/path-key/license b/node_modules/npm-run-path/node_modules/path-key/license
new file mode 100644
index 000000000..654d0bfe9
--- /dev/null
+++ b/node_modules/npm-run-path/node_modules/path-key/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/npm-run-path/node_modules/path-key/package.json b/node_modules/npm-run-path/node_modules/path-key/package.json
new file mode 100644
index 000000000..81e0e8bed
--- /dev/null
+++ b/node_modules/npm-run-path/node_modules/path-key/package.json
@@ -0,0 +1,39 @@
+{
+ "name": "path-key",
+ "version": "2.0.1",
+ "description": "Get the PATH environment variable key cross-platform",
+ "license": "MIT",
+ "repository": "sindresorhus/path-key",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "files": [
+ "index.js"
+ ],
+ "keywords": [
+ "path",
+ "key",
+ "environment",
+ "env",
+ "variable",
+ "var",
+ "get",
+ "cross-platform",
+ "windows"
+ ],
+ "devDependencies": {
+ "ava": "*",
+ "xo": "*"
+ },
+ "xo": {
+ "esnext": true
+ }
+}
diff --git a/node_modules/npm-run-path/node_modules/path-key/readme.md b/node_modules/npm-run-path/node_modules/path-key/readme.md
new file mode 100644
index 000000000..cb5710aac
--- /dev/null
+++ b/node_modules/npm-run-path/node_modules/path-key/readme.md
@@ -0,0 +1,51 @@
+# path-key [![Build Status](https://travis-ci.org/sindresorhus/path-key.svg?branch=master)](https://travis-ci.org/sindresorhus/path-key)
+
+> Get the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable key cross-platform
+
+It's usually `PATH`, but on Windows it can be any casing like `Path`...
+
+
+## Install
+
+```
+$ npm install --save path-key
+```
+
+
+## Usage
+
+```js
+const pathKey = require('path-key');
+
+const key = pathKey();
+//=> 'PATH'
+
+const PATH = process.env[key];
+//=> '/usr/local/bin:/usr/bin:/bin'
+```
+
+
+## API
+
+### pathKey([options])
+
+#### options
+
+##### env
+
+Type: `Object`<br>
+Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env)
+
+Use a custom environment variables object.
+
+#### platform
+
+Type: `string`<br>
+Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform)
+
+Get the PATH key for a specific platform.
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/node_modules/npm-run-path/package.json b/node_modules/npm-run-path/package.json
new file mode 100644
index 000000000..3c27504c5
--- /dev/null
+++ b/node_modules/npm-run-path/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "npm-run-path",
+ "version": "2.0.2",
+ "description": "Get your PATH prepended with locally installed binaries",
+ "license": "MIT",
+ "repository": "sindresorhus/npm-run-path",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "files": [
+ "index.js"
+ ],
+ "keywords": [
+ "npm",
+ "run",
+ "path",
+ "package",
+ "bin",
+ "binary",
+ "binaries",
+ "script",
+ "cli",
+ "command-line",
+ "execute",
+ "executable"
+ ],
+ "dependencies": {
+ "path-key": "^2.0.0"
+ },
+ "devDependencies": {
+ "ava": "*",
+ "xo": "*"
+ },
+ "xo": {
+ "esnext": true
+ }
+}
diff --git a/node_modules/npm-run-path/readme.md b/node_modules/npm-run-path/readme.md
new file mode 100644
index 000000000..4ff4722a6
--- /dev/null
+++ b/node_modules/npm-run-path/readme.md
@@ -0,0 +1,81 @@
+# npm-run-path [![Build Status](https://travis-ci.org/sindresorhus/npm-run-path.svg?branch=master)](https://travis-ci.org/sindresorhus/npm-run-path)
+
+> Get your [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) prepended with locally installed binaries
+
+In [npm run scripts](https://docs.npmjs.com/cli/run-script) you can execute locally installed binaries by name. This enables the same outside npm.
+
+
+## Install
+
+```
+$ npm install --save npm-run-path
+```
+
+
+## Usage
+
+```js
+const childProcess = require('child_process');
+const npmRunPath = require('npm-run-path');
+
+console.log(process.env.PATH);
+//=> '/usr/local/bin'
+
+console.log(npmRunPath());
+//=> '/Users/sindresorhus/dev/foo/node_modules/.bin:/Users/sindresorhus/dev/node_modules/.bin:/Users/sindresorhus/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/usr/local/bin'
+
+// `foo` is a locally installed binary
+childProcess.execFileSync('foo', {
+ env: npmRunPath.env()
+});
+```
+
+
+## API
+
+### npmRunPath([options])
+
+#### options
+
+##### cwd
+
+Type: `string`<br>
+Default: `process.cwd()`
+
+Working directory.
+
+##### path
+
+Type: `string`<br>
+Default: [`PATH`](https://github.com/sindresorhus/path-key)
+
+PATH to be appended.<br>
+Set it to an empty string to exclude the default PATH.
+
+### 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
+
+- [npm-run-path-cli](https://github.com/sindresorhus/npm-run-path-cli) - CLI for this module
+- [execa](https://github.com/sindresorhus/execa) - Execute a locally installed binary
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)