Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update postinstall script to honor npm color config #559

Merged
merged 1 commit into from
May 23, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions packages/core-js/scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}