From 383285ecd5292bf9a825e05904955b937de84cc9 Mon Sep 17 00:00:00 2001 From: Minteck Date: Sat, 4 Jun 2022 08:51:01 +0200 Subject: Initial commit --- node_modules/is-installed-globally/index.d.ts | 19 +++++++++ node_modules/is-installed-globally/index.js | 15 +++++++ node_modules/is-installed-globally/license | 9 +++++ node_modules/is-installed-globally/package.json | 54 +++++++++++++++++++++++++ node_modules/is-installed-globally/readme.md | 31 ++++++++++++++ 5 files changed, 128 insertions(+) create mode 100644 node_modules/is-installed-globally/index.d.ts create mode 100644 node_modules/is-installed-globally/index.js create mode 100644 node_modules/is-installed-globally/license create mode 100644 node_modules/is-installed-globally/package.json create mode 100644 node_modules/is-installed-globally/readme.md (limited to 'node_modules/is-installed-globally') diff --git a/node_modules/is-installed-globally/index.d.ts b/node_modules/is-installed-globally/index.d.ts new file mode 100644 index 0000000..4c2cbba --- /dev/null +++ b/node_modules/is-installed-globally/index.d.ts @@ -0,0 +1,19 @@ +/** +Check if your package was installed globally. + +@example +``` +import isInstalledGlobally = require('is-installed-globally'); + +// With `npm install your-package` +console.log(isInstalledGlobally); +//=> false + +// With `npm install --global your-package` +console.log(isInstalledGlobally); +//=> true +``` +*/ +declare const isInstalledGlobally: boolean; + +export = isInstalledGlobally; diff --git a/node_modules/is-installed-globally/index.js b/node_modules/is-installed-globally/index.js new file mode 100644 index 0000000..7fefcda --- /dev/null +++ b/node_modules/is-installed-globally/index.js @@ -0,0 +1,15 @@ +'use strict'; +const fs = require('fs'); +const globalDirs = require('global-dirs'); +const isPathInside = require('is-path-inside'); + +module.exports = (() => { + try { + return ( + isPathInside(__dirname, globalDirs.yarn.packages) || + isPathInside(__dirname, fs.realpathSync(globalDirs.npm.packages)) + ); + } catch { + return false; + } +})(); diff --git a/node_modules/is-installed-globally/license b/node_modules/is-installed-globally/license new file mode 100644 index 0000000..fa7ceba --- /dev/null +++ b/node_modules/is-installed-globally/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://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/is-installed-globally/package.json b/node_modules/is-installed-globally/package.json new file mode 100644 index 0000000..955eabb --- /dev/null +++ b/node_modules/is-installed-globally/package.json @@ -0,0 +1,54 @@ +{ + "name": "is-installed-globally", + "version": "0.4.0", + "description": "Check if your package was installed globally", + "license": "MIT", + "repository": "sindresorhus/is-installed-globally", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "engines": { + "node": ">=10" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "global", + "package", + "globally", + "module", + "install", + "installed", + "npm", + "yarn", + "is", + "check", + "detect", + "local", + "locally", + "cli", + "bin", + "binary" + ], + "dependencies": { + "global-dirs": "^3.0.0", + "is-path-inside": "^3.0.2" + }, + "devDependencies": { + "ava": "^2.4.0", + "cpy": "^8.1.1", + "del": "^6.0.0", + "execa": "^5.0.0", + "make-dir": "^3.1.0", + "tsd": "^0.14.0", + "xo": "^0.37.1" + } +} diff --git a/node_modules/is-installed-globally/readme.md b/node_modules/is-installed-globally/readme.md new file mode 100644 index 0000000..ef9e18a --- /dev/null +++ b/node_modules/is-installed-globally/readme.md @@ -0,0 +1,31 @@ +# is-installed-globally + +> Check if your package was installed globally + +Can be useful if your CLI needs different behavior when installed globally and locally. + +## Install + +``` +$ npm install is-installed-globally +``` + +## Usage + +```js +const isInstalledGlobally = require('is-installed-globally'); + +// With `npm install your-package` +console.log(isInstalledGlobally); +//=> false + +// With `npm install --global your-package` +console.log(isInstalledGlobally); +//=> true +``` + +## 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 +- [global-dirs](https://github.com/sindresorhus/global-dirs) - Get the directory of globally installed packages and binaries -- cgit