diff options
author | Minteck <contact@minteck.org> | 2022-06-04 08:51:01 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-06-04 08:51:01 +0200 |
commit | 383285ecd5292bf9a825e05904955b937de84cc9 (patch) | |
tree | 0a53b6f02c1604b078044567c03dc1b6c944c8c2 /node_modules/is-npm | |
download | equestriadb-383285ecd5292bf9a825e05904955b937de84cc9.tar.gz equestriadb-383285ecd5292bf9a825e05904955b937de84cc9.tar.bz2 equestriadb-383285ecd5292bf9a825e05904955b937de84cc9.zip |
Initial commit
Diffstat (limited to 'node_modules/is-npm')
-rw-r--r-- | node_modules/is-npm/index.d.ts | 41 | ||||
-rw-r--r-- | node_modules/is-npm/index.js | 11 | ||||
-rw-r--r-- | node_modules/is-npm/license | 9 | ||||
-rw-r--r-- | node_modules/is-npm/package.json | 39 | ||||
-rw-r--r-- | node_modules/is-npm/readme.md | 60 |
5 files changed, 160 insertions, 0 deletions
diff --git a/node_modules/is-npm/index.d.ts b/node_modules/is-npm/index.d.ts new file mode 100644 index 0000000..5338775 --- /dev/null +++ b/node_modules/is-npm/index.d.ts @@ -0,0 +1,41 @@ +/** +Check if your code is running as an [npm](https://docs.npmjs.com/misc/scripts) or [yarn](https://yarnpkg.com/lang/en/docs/cli/run/) script. + +@example +``` +import {isNpmOrYarn} from 'is-npm'; + +if (isNpmOrYarn) { + console.log('Running as an npm or yarn script!'); +} +``` +*/ +export const isNpmOrYarn: boolean; + +/** +Check if your code is running as an [npm](https://docs.npmjs.com/misc/scripts) script. + +@example +``` +import {isNpm} from 'is-npm'; + +if (isNpm) { + console.log('Running as an npm script!'); +} +``` +*/ +export const isNpm: boolean; + +/** +Check if your code is running as a [yarn](https://yarnpkg.com/lang/en/docs/cli/run/) script. + +@example +``` +import {isYarn} from 'is-npm'; + +if (isYarn) { + console.log('Running as a yarn script!'); +} +``` +*/ +export const isYarn: boolean; diff --git a/node_modules/is-npm/index.js b/node_modules/is-npm/index.js new file mode 100644 index 0000000..000a893 --- /dev/null +++ b/node_modules/is-npm/index.js @@ -0,0 +1,11 @@ +'use strict'; + +const packageJson = process.env.npm_package_json; +const userAgent = process.env.npm_config_user_agent; +const isYarn = Boolean(userAgent && userAgent.startsWith('yarn')); +const isNpm = Boolean(userAgent && userAgent.startsWith('npm')); +const isNpm7 = Boolean(packageJson && packageJson.endsWith('package.json')); + +module.exports.isNpmOrYarn = isNpm || isNpm7 || isYarn; +module.exports.isNpm = isNpm || isNpm7; +module.exports.isYarn = isYarn; diff --git a/node_modules/is-npm/license b/node_modules/is-npm/license new file mode 100644 index 0000000..fa7ceba --- /dev/null +++ b/node_modules/is-npm/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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-npm/package.json b/node_modules/is-npm/package.json new file mode 100644 index 0000000..fad5d25 --- /dev/null +++ b/node_modules/is-npm/package.json @@ -0,0 +1,39 @@ +{ + "name": "is-npm", + "version": "5.0.0", + "description": "Check if your code is running as an npm script", + "license": "MIT", + "repository": "sindresorhus/is-npm", + "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": [ + "npm", + "yarn", + "is", + "check", + "detect", + "env", + "environment", + "run", + "script" + ], + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.11.0", + "xo": "^0.30.0" + } +} diff --git a/node_modules/is-npm/readme.md b/node_modules/is-npm/readme.md new file mode 100644 index 0000000..b18ba10 --- /dev/null +++ b/node_modules/is-npm/readme.md @@ -0,0 +1,60 @@ +# is-npm [![Build Status](https://travis-ci.com/sindresorhus/is-npm.svg?branch=master)](https://travis-ci.com/sindresorhus/is-npm) + +> Check if your code is running as an [npm](https://docs.npmjs.com/misc/scripts) or [yarn](https://yarnpkg.com/lang/en/docs/cli/run/) script + +## Install + +``` +$ npm install is-npm +``` + +## Usage + +```js +const {isNpmOrYarn, isNpm, isYarn} = require('is-npm'); + +console.table({isNpmOrYarn, isNpm, isYarn}); +``` + +```sh +$ node foo.js +# ┌─────────────┬────────┐ +# │ (index) │ Values │ +# ├─────────────┼────────┤ +# │ isNpmOrYarn │ false │ +# │ isNpm │ false │ +# │ isYarn │ false │ +# └─────────────┴────────┘ +$ npm run foo +# ┌─────────────┬────────┐ +# │ (index) │ Values │ +# ├─────────────┼────────┤ +# │ isNpmOrYarn │ true │ +# │ isNpm │ true │ +# │ isYarn │ false │ +# └─────────────┴────────┘ +$ yarn run foo +# ┌─────────────┬────────┐ +# │ (index) │ Values │ +# ├─────────────┼────────┤ +# │ isNpmOrYarn │ true │ +# │ isNpm │ false │ +# │ isYarn │ true │ +# └─────────────┴────────┘ +``` + +## Related + +- [is-npm-cli](https://github.com/sindresorhus/is-npm-cli) - CLI for this module + +--- + +<div align="center"> + <b> + <a href="https://tidelift.com/subscription/pkg/npm-is-npm?utm_source=npm-is-npm&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> + </b> + <br> + <sub> + Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. + </sub> +</div> |