aboutsummaryrefslogtreecommitdiff
path: root/node_modules/npm-run-path
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2019-10-06 21:37:45 +0200
committerDimitri Staessens <[email protected]>2019-10-06 21:37:45 +0200
commit3c51c3be85bb0d1bdb87ea0d6632f1c256912f27 (patch)
treec7ccc8279b12c4f7bdbbb4270d617e48f51722e4 /node_modules/npm-run-path
parent412c104bebc507bea9c94fd53b5bdc4b64cbfe31 (diff)
downloadwebsite-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.tar.gz
website-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.zip
build: Add some required modules for node
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/package.json81
-rw-r--r--node_modules/npm-run-path/readme.md81
4 files changed, 222 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 0000000..56f31e4
--- /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 0000000..654d0bf
--- /dev/null
+++ b/node_modules/npm-run-path/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <[email protected]> (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/package.json b/node_modules/npm-run-path/package.json
new file mode 100644
index 0000000..f756a3a
--- /dev/null
+++ b/node_modules/npm-run-path/package.json
@@ -0,0 +1,81 @@
+{
+ "_args": [
+ [
+ "/home/dstaesse/git/website"
+ ]
+ ],
+ "_development": true,
+ "_from": "[email protected]",
+ "_id": "[email protected]",
+ "_inBundle": false,
+ "_integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=",
+ "_location": "/npm-run-path",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "version",
+ "registry": true,
+ "raw": "[email protected]",
+ "name": "npm-run-path",
+ "escapedName": "npm-run-path",
+ "rawSpec": "2.0.2",
+ "saveSpec": null,
+ "fetchSpec": "2.0.2"
+ },
+ "_requiredBy": [
+ "/execa"
+ ],
+ "_resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
+ "_spec": "2.0.2",
+ "_where": "/home/dstaesse/git/website",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "[email protected]",
+ "url": "sindresorhus.com"
+ },
+ "bugs": {
+ "url": "https://github.com/sindresorhus/npm-run-path/issues"
+ },
+ "dependencies": {
+ "path-key": "^2.0.0"
+ },
+ "description": "Get your PATH prepended with locally installed binaries",
+ "devDependencies": {
+ "ava": "*",
+ "xo": "*"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "files": [
+ "index.js"
+ ],
+ "homepage": "https://github.com/sindresorhus/npm-run-path#readme",
+ "keywords": [
+ "npm",
+ "run",
+ "path",
+ "package",
+ "bin",
+ "binary",
+ "binaries",
+ "script",
+ "cli",
+ "command-line",
+ "execute",
+ "executable"
+ ],
+ "license": "MIT",
+ "name": "npm-run-path",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/sindresorhus/npm-run-path.git"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "version": "2.0.2",
+ "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 0000000..4ff4722
--- /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)