Skip to content

Commit

Permalink
improve the postinstall script
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Dec 8, 2019
1 parent 24d1eaa commit 758181c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## Changelog
##### 2.6.11 [LEGACY] - 2019.12.09
- Returned usage of `node -e` in `postinstall` scripts for better cross-platform compatibility, [#582](https://github.com/zloirock/core-js/issues/582)
- Improved CI detection in the `postinstall` script, [#707](https://github.com/zloirock/core-js/issues/707)

##### 2.6.10 [LEGACY] - 2019.10.13
- Show similar `postinstall` messages only once per `npm i`, [#597](https://github.com/zloirock/core-js/issues/597)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"promises-tests": "promises-aplus-tests tests/promises-aplus/adapter",
"observables-tests": "node tests/observables/adapter && node tests/observables/adapter-library",
"test": "npm run grunt clean copy && npm run lint && npm run grunt livescript client karma:default && npm run grunt library karma:library && npm run promises-tests && npm run observables-tests && lsc tests/commonjs",
"postinstall": "node postinstall || echo \"ignore\""
"postinstall": "node -e \"try{require('./postinstall')}catch(e){}\""
},
"license": "MIT",
"keywords": [
Expand Down
9 changes: 8 additions & 1 deletion postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@ var path = require('path');
var env = process.env;

var ADBLOCK = is(env.ADBLOCK);
var CI = is(env.CI);
var COLOR = is(env.npm_config_color);
var DISABLE_OPENCOLLECTIVE = is(env.DISABLE_OPENCOLLECTIVE);
var SILENT = ['silent', 'error', 'warn'].indexOf(env.npm_config_loglevel) !== -1;
var MINUTE = 60 * 1000;

// you could add a PR with an env variable for your CI detection
var CI = [
'BUILD_NUMBER',
'CI',
'CONTINUOUS_INTEGRATION',
'RUN_ID'
].some(function (it) { return is(env[it]); });

var BANNER = '\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\n' +
'\u001B[96mThe project needs your help! Please consider supporting of core-js on Open Collective or Patreon: \u001B[0m\n' +
'\u001B[96m>\u001B[94m https://opencollective.com/core-js \u001B[0m\n' +
Expand Down

0 comments on commit 758181c

Please sign in to comment.