From d4643ae5d0749a53dff6adaeb2f50fb6d48bceaf Mon Sep 17 00:00:00 2001 From: "devid.farinelli@gmail.com" Date: Fri, 26 Apr 2019 19:35:59 +0200 Subject: [PATCH] feat(opencollective prompt): add option to disable it + doc --- README.md | 16 ++++++++++++---- bin/opencollective.js | 7 ++++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7238f3fede1..af6864f0f8d 100644 --- a/README.md +++ b/README.md @@ -23,12 +23,14 @@ [![GitHub contributors](https://img.shields.io/github/contributors/webpack/webpack-cli.svg)](https://github.com/webpack/webpack-cli/graphs/contributors) - [About](#about) - - [How to install](#how-to-install) -- [Getting Started](#getting-started) + - [How to install](#how-to-install) +- [Packages](#packages) + - [Commands](#commands) + - [Utilities](#utilities) +- [Getting started](#getting-started) - [webpack CLI Scaffolds](#webpack-cli-scaffolds) -- [Commands](#commands) -- [webpack.config.js](https://webpack.js.org/concepts/configuration/) - [Contributing and Internal Documentation](#contributing-and-internal-documentation) +- [Open Collective](#open-collective) ## About @@ -89,3 +91,9 @@ The webpack family welcomes any contributor, small or big. We are happy to elabo [deps]: https://img.shields.io/david/webpack/webpack.svg [deps-url]: https://david-dm.org/webpack/webpack-cli + +## Open Collective + +If you like **webpack** Please consider donating to our [Open Collective](https://opencollective.com/webpack) to help us maintain it. + +We show this message in the terminal once in a while, if you want you can disable it by setting the environment variable `DISABLE_OPENCOLLECTIVE=true` or `CI=true`. \ No newline at end of file diff --git a/bin/opencollective.js b/bin/opencollective.js index a6266a25b4e..3d8a2966d23 100644 --- a/bin/opencollective.js +++ b/bin/opencollective.js @@ -30,4 +30,9 @@ function printBadge() { console.log("\n"); } -printBadge(); +function isTrue(value) { + return !!value && value !== "0" && value !== "false"; +} +var envDisable = isTrue(process.env.DISABLE_OPENCOLLECTIVE) || isTrue(process.env.CI); + +if (!envDisable) printBadge();