diff options
Diffstat (limited to 'node_modules/opencollective-postinstall')
| -rw-r--r-- | node_modules/opencollective-postinstall/LICENSE | 21 | ||||
| -rw-r--r-- | node_modules/opencollective-postinstall/README.md | 34 | ||||
| -rwxr-xr-x | node_modules/opencollective-postinstall/index.js | 18 | ||||
| -rw-r--r-- | node_modules/opencollective-postinstall/package.json | 32 |
4 files changed, 105 insertions, 0 deletions
diff --git a/node_modules/opencollective-postinstall/LICENSE b/node_modules/opencollective-postinstall/LICENSE new file mode 100644 index 00000000..908bbc2e --- /dev/null +++ b/node_modules/opencollective-postinstall/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Open Collective + +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/opencollective-postinstall/README.md b/node_modules/opencollective-postinstall/README.md new file mode 100644 index 00000000..fd571fea --- /dev/null +++ b/node_modules/opencollective-postinstall/README.md @@ -0,0 +1,34 @@ +# Open Collective postinstall + +[](https://greenkeeper.io/) + +Lightweight npm postinstall message to invite people to donate to your collective + +## Installation + +``` +npm install --save opencollective-postinstall +``` + +And in your `package.json` add: + +```json +{ + ... + "scripts": { + "postinstall": "opencollective-postinstall" + }, + "collective": { + "url": "https://opencollective.com/webpack" + } + ... +} +``` + +## Disabling this message + +In some places (e.g. CI) you may want to disable this output. You can do this by setting the environment variable `DISABLE_OPENCOLLECTIVE=true`. + +It will not be shown if npm's log level is set to silent (`--silent`), warn (`--quiet`), or error (`--loglevel error`). + +Note: This is a lightweight alternative to the [opencollective-cli](https://github.com/opencollective/opencollective-cli) that offers a more complete postinstall message with the current balance and ASCII logo of the collective. diff --git a/node_modules/opencollective-postinstall/index.js b/node_modules/opencollective-postinstall/index.js new file mode 100755 index 00000000..8b8ce0f8 --- /dev/null +++ b/node_modules/opencollective-postinstall/index.js @@ -0,0 +1,18 @@ +#!/usr/bin/env node + +function isTrue(value) { + return !!value && value !== "0" && value !== "false" +} + +var envDisable = isTrue(process.env.DISABLE_OPENCOLLECTIVE) || isTrue(process.env.OPEN_SOURCE_CONTRIBUTOR) || isTrue(process.env.CI); +var logLevel = process.env.npm_config_loglevel; +var logLevelDisplay = ['silent', 'error', 'warn'].indexOf(logLevel) > -1; + +if (!envDisable && !logLevelDisplay) { + var pkg = require(require('path').resolve('./package.json')); + if (pkg.collective) { + console.log(`\u001b[96m\u001b[1mThank you for using ${pkg.name}!\u001b[96m\u001b[1m`); + console.log(`\u001b[0m\u001b[96mIf you rely on this package, please consider supporting our open collective:\u001b[22m\u001b[39m`); + console.log(`> \u001b[94m${pkg.collective.url}/donate\u001b[0m\n`); + } +} diff --git a/node_modules/opencollective-postinstall/package.json b/node_modules/opencollective-postinstall/package.json new file mode 100644 index 00000000..ca330991 --- /dev/null +++ b/node_modules/opencollective-postinstall/package.json @@ -0,0 +1,32 @@ +{ + "name": "opencollective-postinstall", + "version": "2.0.3", + "description": "Lightweight npm postinstall message to invite people to donate to your collective", + "main": "index.js", + "scripts": { + "test": "jest" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/opencollective/opencollective-postinstall.git" + }, + "files": [ + "index.js" + ], + "bin": "index.js", + "keywords": [ + "opencollective", + "donation", + "funding", + "sustain" + ], + "author": "Xavier Damman (@xdamman)", + "license": "MIT", + "bugs": { + "url": "https://github.com/opencollective/opencollective-postinstall/issues" + }, + "homepage": "https://github.com/opencollective/opencollective-postinstall#readme", + "devDependencies": { + "jest": "^26.0.1" + } +} |
