From e1816536d3b5b856bd830491d779c785177050fc Mon Sep 17 00:00:00 2001 From: Philipp Kief Date: Thu, 23 May 2019 12:49:17 +0200 Subject: [PATCH] Update postinstall script to honor npm color config Closes #556 --- packages/core-js/scripts/postinstall.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/core-js/scripts/postinstall.js b/packages/core-js/scripts/postinstall.js index 0a99ae1a34af..6a3d04a3d31c 100644 --- a/packages/core-js/scripts/postinstall.js +++ b/packages/core-js/scripts/postinstall.js @@ -2,11 +2,20 @@ var env = process.env; var CI = !!env.CI && env.CI !== '0' && env.CI !== 'false'; var SILENT = !!~['silent', 'error', 'warn'].indexOf(env.npm_config_loglevel); +var COLOR = !!env.npm_config_color; if (!CI && !SILENT) { - console.log('\u001B[96mThank you for using core-js (\u001B[94m https://github.com/zloirock/core-js \u001B[96m) for polyfilling JavaScript standard library!\u001B[0m\n'); - console.log('\u001B[96mPlease consider supporting of core-js on Open Collective or Patreon: \u001B[0m'); - console.log('\u001B[96m>\u001B[94m https://opencollective.com/core-js \u001B[0m'); - console.log('\u001B[96m>\u001B[94m https://www.patreon.com/zloirock \u001B[0m\n'); - console.log('\u001B[96mAlso, the author of core-js (\u001B[94m https://github.com/zloirock \u001B[96m) is looking for a good job -)\u001B[0m\n'); + if (COLOR) { + console.log('\u001B[96mThank you for using core-js (\u001B[94m https://github.com/zloirock/core-js \u001B[96m) for polyfilling JavaScript standard library!\u001B[0m\n'); + console.log('\u001B[96mPlease consider supporting of core-js on Open Collective or Patreon: \u001B[0m'); + console.log('\u001B[96m>\u001B[94m https://opencollective.com/core-js \u001B[0m'); + console.log('\u001B[96m>\u001B[94m https://www.patreon.com/zloirock \u001B[0m\n'); + console.log('\u001B[96mAlso, the author of core-js (\u001B[94m https://github.com/zloirock \u001B[96m) is looking for a good job -)\u001B[0m\n'); + } else { + console.log('Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!\n'); + console.log('Please consider supporting of core-js on Open Collective or Patreon:'); + console.log('> https://opencollective.com/core-js'); + console.log('> https://www.patreon.com/zloirock \n'); + console.log('Also, the author of core-js (https://github.com/zloirock) is looking for a good job -)\n'); + } }