summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/global-dirs
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2018-04-20 18:26:37 -0700
committerRebecca Turner <me@re-becca.org>2018-05-24 23:24:45 -0700
commit468ab4519e1b92473acefb22801497a1af6aebae (patch)
treebdac1d062cd4b094bde3a21147bab5d82c792ece /deps/npm/node_modules/global-dirs
parentac8226115e2192a7a46ba07789fa5136f74223e1 (diff)
downloadandroid-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.tar.gz
android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.tar.bz2
android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.zip
deps: upgrade npm to 6.1.0
PR-URL: https://github.com/nodejs/node/pull/20190 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Diffstat (limited to 'deps/npm/node_modules/global-dirs')
-rw-r--r--deps/npm/node_modules/global-dirs/index.js90
-rw-r--r--deps/npm/node_modules/global-dirs/license9
-rw-r--r--deps/npm/node_modules/global-dirs/package.json84
-rw-r--r--deps/npm/node_modules/global-dirs/readme.md69
4 files changed, 252 insertions, 0 deletions
diff --git a/deps/npm/node_modules/global-dirs/index.js b/deps/npm/node_modules/global-dirs/index.js
new file mode 100644
index 0000000000..2b61d4eae2
--- /dev/null
+++ b/deps/npm/node_modules/global-dirs/index.js
@@ -0,0 +1,90 @@
+'use strict';
+const path = require('path');
+const os = require('os');
+const fs = require('fs');
+const ini = require('ini');
+
+const readRc = fp => {
+ try {
+ return ini.parse(fs.readFileSync(fp, 'utf8')).prefix;
+ } catch (err) {}
+};
+
+const defaultNpmPrefix = (() => {
+ if (process.env.PREFIX) {
+ return process.env.PREFIX;
+ }
+
+ if (process.platform === 'win32') {
+ // `c:\node\node.exe` → `prefix=c:\node\`
+ return path.dirname(process.execPath);
+ }
+
+ // `/usr/local/bin/node` → `prefix=/usr/local`
+ return path.dirname(path.dirname(process.execPath));
+})();
+
+const getNpmPrefix = () => {
+ if (process.env.PREFIX) {
+ return process.env.PREFIX;
+ }
+
+ const homePrefix = readRc(path.join(os.homedir(), '.npmrc'));
+ if (homePrefix) {
+ return homePrefix;
+ }
+
+ const globalConfigPrefix = readRc(path.resolve(defaultNpmPrefix, 'etc', 'npmrc'));
+ if (globalConfigPrefix) {
+ return globalConfigPrefix;
+ }
+
+ if (process.platform === 'win32' && process.env.APPDATA) {
+ // Hardcoded contents of `c:\Program Files\nodejs\node_modules\npm\.npmrc`
+ const prefix = path.join(process.env.APPDATA, 'npm');
+ if (fs.existsSync(prefix)) {
+ return prefix;
+ }
+ }
+
+ return defaultNpmPrefix;
+};
+
+const npmPrefix = path.resolve(getNpmPrefix());
+
+const getYarnPrefix = () => {
+ if (process.env.PREFIX) {
+ return process.env.PREFIX;
+ }
+
+ if (process.platform === 'win32' && process.env.LOCALAPPDATA) {
+ const prefix = path.join(process.env.LOCALAPPDATA, 'Yarn');
+ if (fs.existsSync(prefix)) {
+ return prefix;
+ }
+ }
+
+ const configPrefix = path.join(os.homedir(), '.config/yarn');
+ if (fs.existsSync(configPrefix)) {
+ return configPrefix;
+ }
+
+ const homePrefix = path.join(os.homedir(), '.yarn-config');
+ if (fs.existsSync(homePrefix)) {
+ return homePrefix;
+ }
+
+ // Yarn supports the npm conventions but the inverse is not true
+ return npmPrefix;
+};
+
+exports.npm = {};
+exports.npm.prefix = npmPrefix;
+exports.npm.packages = path.join(npmPrefix, process.platform === 'win32' ? 'node_modules' : 'lib/node_modules');
+exports.npm.binaries = process.platform === 'win32' ? npmPrefix : path.join(npmPrefix, 'bin');
+
+const yarnPrefix = path.resolve(getYarnPrefix());
+exports.yarn = {};
+exports.yarn.prefix = yarnPrefix;
+exports.yarn.packages = path.join(yarnPrefix, process.platform === 'win32' ? 'config/global/node_modules' : 'global/node_modules');
+exports.yarn.binaries = path.join(exports.yarn.packages, '.bin');
diff --git a/deps/npm/node_modules/global-dirs/license b/deps/npm/node_modules/global-dirs/license
new file mode 100644
index 0000000000..e7af2f7710
--- /dev/null
+++ b/deps/npm/node_modules/global-dirs/license
@@ -0,0 +1,9 @@
+MIT License
+
+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/deps/npm/node_modules/global-dirs/package.json b/deps/npm/node_modules/global-dirs/package.json
new file mode 100644
index 0000000000..41f0a2e2d3
--- /dev/null
+++ b/deps/npm/node_modules/global-dirs/package.json
@@ -0,0 +1,84 @@
+{
+ "_from": "global-dirs@^0.1.0",
+ "_id": "global-dirs@0.1.1",
+ "_inBundle": false,
+ "_integrity": "sha1-sxnA3UYH81PzvpzKTHL8FIxJ9EU=",
+ "_location": "/global-dirs",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "global-dirs@^0.1.0",
+ "name": "global-dirs",
+ "escapedName": "global-dirs",
+ "rawSpec": "^0.1.0",
+ "saveSpec": null,
+ "fetchSpec": "^0.1.0"
+ },
+ "_requiredBy": [
+ "/is-installed-globally"
+ ],
+ "_resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz",
+ "_shasum": "b319c0dd4607f353f3be9cca4c72fc148c49f445",
+ "_spec": "global-dirs@^0.1.0",
+ "_where": "/Users/rebecca/code/npm/node_modules/is-installed-globally",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "bugs": {
+ "url": "https://github.com/sindresorhus/global-dirs/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {
+ "ini": "^1.3.4"
+ },
+ "deprecated": false,
+ "description": "Get the directory of globally installed packages and binaries",
+ "devDependencies": {
+ "ava": "*",
+ "execa": "^0.7.0",
+ "xo": "*"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "files": [
+ "index.js"
+ ],
+ "homepage": "https://github.com/sindresorhus/global-dirs#readme",
+ "keywords": [
+ "global",
+ "prefix",
+ "path",
+ "paths",
+ "npm",
+ "yarn",
+ "node",
+ "modules",
+ "node-modules",
+ "package",
+ "packages",
+ "binary",
+ "binaries",
+ "bin",
+ "directory",
+ "directories",
+ "npmrc",
+ "rc",
+ "config",
+ "root",
+ "resolve"
+ ],
+ "license": "MIT",
+ "name": "global-dirs",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/sindresorhus/global-dirs.git"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "version": "0.1.1"
+}
diff --git a/deps/npm/node_modules/global-dirs/readme.md b/deps/npm/node_modules/global-dirs/readme.md
new file mode 100644
index 0000000000..1acea6d739
--- /dev/null
+++ b/deps/npm/node_modules/global-dirs/readme.md
@@ -0,0 +1,69 @@
+# global-dirs [![Build Status](https://travis-ci.org/sindresorhus/global-dirs.svg?branch=master)](https://travis-ci.org/sindresorhus/global-dirs)
+
+> Get the directory of globally installed packages and binaries
+
+Uses the same resolution logic as `npm` and `yarn`.
+
+
+## Install
+
+```
+$ npm install global-dirs
+```
+
+
+## Usage
+
+```js
+const globalDirs = require('global-dirs');
+
+console.log(globalDirs.npm.prefix);
+//=> '/usr/local'
+
+console.log(globalDirs.npm.packages);
+//=> '/usr/local/lib/node_modules'
+
+console.log(globalDirs.npm.binaries);
+//=> '/usr/local/bin'
+
+console.log(globalDirs.yarn.packages);
+//=> '/Users/sindresorhus/.config/yarn/global/node_modules'
+```
+
+
+## API
+
+### globalDirs
+
+#### npm
+#### yarn
+
+##### packages
+
+Directory with globally installed packages.
+
+Equivalent to `npm root --global`.
+
+##### binaries
+
+Directory with globally installed binaries.
+
+Equivalent to `npm bin --global`.
+
+##### prefix
+
+Directory with directories for packages and binaries. You probably want either of the above.
+
+Equivalent to `npm prefix --global`.
+
+
+## Related
+
+- [import-global](https://github.com/sindresorhus/import-global) - Import a globally installed module
+- [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module
+- [is-installed-globally](https://github.com/sindresorhus/is-installed-globally) - Check if your package was installed globally
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)