Skip to content

Commit 758181c

Browse files
committedDec 8, 2019
improve the postinstall script
1 parent 24d1eaa commit 758181c

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed
 

‎CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
## Changelog
2+
##### 2.6.11 [LEGACY] - 2019.12.09
3+
- Returned usage of `node -e` in `postinstall` scripts for better cross-platform compatibility, [#582](https://github.com/zloirock/core-js/issues/582)
4+
- Improved CI detection in the `postinstall` script, [#707](https://github.com/zloirock/core-js/issues/707)
5+
26
##### 2.6.10 [LEGACY] - 2019.10.13
37
- Show similar `postinstall` messages only once per `npm i`, [#597](https://github.com/zloirock/core-js/issues/597)
48

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"promises-tests": "promises-aplus-tests tests/promises-aplus/adapter",
3939
"observables-tests": "node tests/observables/adapter && node tests/observables/adapter-library",
4040
"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",
41-
"postinstall": "node postinstall || echo \"ignore\""
41+
"postinstall": "node -e \"try{require('./postinstall')}catch(e){}\""
4242
},
4343
"license": "MIT",
4444
"keywords": [

‎postinstall.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@ var path = require('path');
55
var env = process.env;
66

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

13+
// you could add a PR with an env variable for your CI detection
14+
var CI = [
15+
'BUILD_NUMBER',
16+
'CI',
17+
'CONTINUOUS_INTEGRATION',
18+
'RUN_ID'
19+
].some(function (it) { return is(env[it]); });
20+
1421
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' +
1522
'\u001B[96mThe project needs your help! Please consider supporting of core-js on Open Collective or Patreon: \u001B[0m\n' +
1623
'\u001B[96m>\u001B[94m https://opencollective.com/core-js \u001B[0m\n' +

0 commit comments

Comments
 (0)
Please sign in to comment.