1 |
|
2 | var env = process.env;
|
3 |
|
4 | var ADBLOCK = is(env.ADBLOCK);
|
5 | var COLOR = is(env.npm_config_color);
|
6 | var DISABLE_OPENCOLLECTIVE = is(env.DISABLE_OPENCOLLECTIVE);
|
7 | var SILENT = ['silent', 'error', 'warn'].indexOf(env.npm_config_loglevel) !== -1;
|
8 | var OPEN_SOURCE_CONTRIBUTOR = is(env.OPEN_SOURCE_CONTRIBUTOR);
|
9 |
|
10 |
|
11 | var CI = [
|
12 | 'BUILD_NUMBER',
|
13 | 'CI',
|
14 | 'CONTINUOUS_INTEGRATION',
|
15 | 'DRONE',
|
16 | 'RUN_ID'
|
17 | ].some(function (it) { return is(env[it]); });
|
18 |
|
19 | var BANNER = '\u001b[35m\u001b[1mLove Swiper? Support Vladimir\'s work by donating or pledging: \u001B[0m\n' +
|
20 | '\u001b[22m\u001b[39m\u001b[32m> On Patreon https://patreon.com/swiperjs \u001B[0m\n' +
|
21 | '\u001b[22m\u001b[39m\u001b[32m> On Open Collective https://opencollective.com/swiper';
|
22 |
|
23 | function is(it) {
|
24 | return !!it && it !== '0' && it !== 'false';
|
25 | }
|
26 |
|
27 | function isBannerRequired() {
|
28 | return !(ADBLOCK || CI || DISABLE_OPENCOLLECTIVE || SILENT || OPEN_SOURCE_CONTRIBUTOR);
|
29 | }
|
30 |
|
31 | function showBanner() {
|
32 |
|
33 | console.log(COLOR ? BANNER : BANNER.replace(/\u001B\[\d+m/g, ''));
|
34 | }
|
35 |
|
36 | if (isBannerRequired()) showBanner();
|