├── .gitignore ├── LICENSE ├── README.md ├── lerna.json ├── package.json ├── packages ├── climate-change-reminder │ ├── README.md │ ├── assets │ │ ├── ss-0.png │ │ └── ss-1.png │ ├── index.js │ ├── package.json │ └── yarn.lock └── use-climate-change-reminder │ ├── index.js │ └── package.json └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | coverage 4 | 5 | *.log -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Michael Fix 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | packages/climate-change-reminder/README.md -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "npmClient": "yarn", 3 | "packages": [ 4 | "packages/*" 5 | ], 6 | "version": "0.0.7", 7 | "create": { 8 | "license": "MIT" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "climate-change-reminder", 4 | "scripts": { 5 | "test": "jest", 6 | "publish": "lerna publish" 7 | }, 8 | "keywords": [ 9 | "climate", 10 | "change", 11 | "is", 12 | "real", 13 | "and", 14 | "accelerating" 15 | ], 16 | "author": "mfix22", 17 | "license": "MIT", 18 | "devDependencies": { 19 | "lerna": "^3.13.4" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/climate-change-reminder/README.md: -------------------------------------------------------------------------------- 1 |

🌍🌏 climate-change-reminder 🌎🌍

2 | 3 |
4 | 5 | 6 | 7 |
8 |
9 | 10 | > Fight the climate crisis by spreading the message for how you can help. 11 | 12 | [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) 13 | 14 | ## Usage 🌳 15 | 16 | You can either add `use-climate-change-reminder` as a dependency like: 17 | 18 | ```shell 19 | $ yarn add use-climate-change-reminder 20 | ``` 21 | 22 | or 23 | 24 | ```shell 25 | $ npm install --save use-climate-change-reminder 26 | ``` 27 | 28 | to automatically print the message after installation. 29 | 30 | Otherwise you can 31 | import and call the function manually in your project: 32 | 33 | ```javascript 34 | const climateChangeReminder = require('climate-change-reminder') 35 | 36 | console.log(climateChangeReminder()) 37 | ``` 38 | 39 | ## Contributing 🤝 40 | Pull requests are more than welcome! If you have something to add, even a question, please feel free to [open an issue](https://github.com/mfix22/use-climate-change-reminder/issues/new) or PR. 41 | -------------------------------------------------------------------------------- /packages/climate-change-reminder/assets/ss-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfix22/use-climate-change-reminder/a91dbeb230b1c0c57af975cd67743700d4dbdcb2/packages/climate-change-reminder/assets/ss-0.png -------------------------------------------------------------------------------- /packages/climate-change-reminder/assets/ss-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mfix22/use-climate-change-reminder/a91dbeb230b1c0c57af975cd67743700d4dbdcb2/packages/climate-change-reminder/assets/ss-1.png -------------------------------------------------------------------------------- /packages/climate-change-reminder/index.js: -------------------------------------------------------------------------------- 1 | const boxen = require('boxen') 2 | const chalk = require('chalk') 3 | const link = require('terminal-link') 4 | const r = require('rexrex') 5 | 6 | const linkPattern = r.and( 7 | '\\[', 8 | r.capture(r.extra(r.matchers.ANY, true)), 9 | '\\]', 10 | '\\(', 11 | r.capture(r.extra(r.matchers.ANY, true)), 12 | '\\)' 13 | ) 14 | 15 | const newLinePattern = r.group(r.or(r.and('\\r', '\\n'), '\\r', '\\n')) 16 | 17 | const TRAGEDIES = [ 18 | 'extreme weather', 19 | 'mass extinctions', 20 | 'water shortages', 21 | 'crop failures', 22 | 'wildfires', 23 | 'mass migrations', 24 | 'rising sea levels' 25 | ] 26 | 27 | const INDENT = '\n ' 28 | const IDEAS = [ 29 | `[Vote for those who prioritize the planet](https://climatechoice.co/change-your-lifestyle).`, 30 | `[Encourage your government officials to take action](https://climatechoice.co/change-your-lifestyle)\nagainst climate change.`, 31 | `If you are able to, [make the switch to a renewable energy supplier](https://climatechoice.co/choose-renewable-energy),\nor have solar panels installed yourself.`, 32 | `[Refrain from using a fossil fuel powered vehicle](https://climatechoice.co/change-how-you-travel),\nand switch to electric vehicles, cycling,\npublic transportation, or walking.`, 33 | `Offset your carbon footprint with services\nlike [Project Wren](https://projectwren.com/) and [Offset Earth](https://offset.earth/).`, 34 | `Join a [climate action group](https://erikareinhardt.com/personal-climate-action#climate-action-groups) in your area.` 35 | ] 36 | .map(s => { 37 | const matches = s.match(r.regex(linkPattern, 'g')) 38 | 39 | if (matches) { 40 | return matches.reduce((accum, pattern) => { 41 | const match = pattern.match(r.regex(linkPattern)) 42 | 43 | return accum.replace(match[0], link(match[1], match[2])) 44 | }, s) 45 | } 46 | 47 | return s 48 | }) 49 | .map(s => s.replace(r.regex(newLinePattern, 'g'), INDENT)) 50 | 51 | function shuffle(arr) { 52 | let array = arr.slice() 53 | let m = array.length 54 | 55 | while (m > 0) { 56 | // Pick a remaining element… 57 | const i = Math.floor(Math.random() * m--) 58 | 59 | const t = array[m] 60 | array[m] = array[i] 61 | array[i] = t 62 | } 63 | 64 | return array 65 | } 66 | 67 | // const site = link(chalk.green('climatechoice.co'), 'https://climatechoice.co/') 68 | // Visit ${site} and find out what you can do to help. 69 | 70 | function formatMessage() { 71 | const t = shuffle(TRAGEDIES) 72 | const idea = shuffle(IDEAS).pop() 73 | 74 | const warnings = [t.pop(), t.pop(), t.pop()].map(w => chalk.bold.keyword('orange')(w)) 75 | 76 | const message = ` 77 | ${chalk.cyan('Climate change')} is ${chalk.bold('real')} and ${chalk.bold('accelerating')}. 78 | 79 | We must cut global emissions in half by 2030 or face: 80 | ${warnings.join(', ')}, and more 81 | 82 | 83 | ${chalk.yellowBright('🌳 IDEA')}: ${idea} 84 | ` 85 | 86 | return boxen(message.trim(), { 87 | padding: 1, 88 | borderColor: 'green', 89 | margin: 1, 90 | borderStyle: 'round' 91 | }) 92 | } 93 | 94 | module.exports = formatMessage 95 | -------------------------------------------------------------------------------- /packages/climate-change-reminder/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "climate-change-reminder", 3 | "version": "0.0.7", 4 | "main": "index.js", 5 | "description": "Help fight the climate change crisis by spreading the message.", 6 | "keywords": [ 7 | "climate", 8 | "change", 9 | "is", 10 | "real", 11 | "and", 12 | "accelerating" 13 | ], 14 | "author": "mfix22", 15 | "license": "MIT", 16 | "dependencies": { 17 | "boxen": "^4.1.0", 18 | "chalk": "^2.4.2", 19 | "once": "^1.4.0", 20 | "rexrex": "^1.3.0", 21 | "terminal-link": "^2.0.0" 22 | }, 23 | "repository": { 24 | "type": "git", 25 | "url": "git+https://github.com/mfix22/use-climate-change-reminder.git" 26 | }, 27 | "homepage": "https://github.com/mfix22/use-climate-change-reminder#readme" 28 | } 29 | -------------------------------------------------------------------------------- /packages/climate-change-reminder/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | ansi-align@^3.0.0: 6 | version "3.0.0" 7 | resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-3.0.0.tgz#b536b371cf687caaef236c18d3e21fe3797467cb" 8 | integrity sha512-ZpClVKqXN3RGBmKibdfWzqCY4lnjEuoNzU5T0oEFpfd/z5qJHVarukridD4juLO2FXMiwUQxr9WqQtaYa8XRYw== 9 | dependencies: 10 | string-width "^3.0.0" 11 | 12 | ansi-escapes@^4.2.1: 13 | version "4.2.1" 14 | resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.2.1.tgz#4dccdb846c3eee10f6d64dea66273eab90c37228" 15 | integrity sha512-Cg3ymMAdN10wOk/VYfLV7KCQyv7EDirJ64500sU7n9UlmioEtDuU5Gd+hj73hXSU/ex7tHJSssmyftDdkMLO8Q== 16 | dependencies: 17 | type-fest "^0.5.2" 18 | 19 | ansi-regex@^4.1.0: 20 | version "4.1.0" 21 | resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" 22 | integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== 23 | 24 | ansi-styles@^3.2.1: 25 | version "3.2.1" 26 | resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" 27 | integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== 28 | dependencies: 29 | color-convert "^1.9.0" 30 | 31 | boxen@^4.1.0: 32 | version "4.1.0" 33 | resolved "https://registry.yarnpkg.com/boxen/-/boxen-4.1.0.tgz#256f6b2eb09ba22ea558e5acc0a5ff637bf8ed03" 34 | integrity sha512-Iwq1qOkmEsl0EVABa864Bbj3HCL4186DRZgFW/NrFs5y5GMM3ljsxzMLgOHdWISDRvcM8beh8q4tTNzXz+mSKg== 35 | dependencies: 36 | ansi-align "^3.0.0" 37 | camelcase "^5.3.1" 38 | chalk "^2.4.2" 39 | cli-boxes "^2.2.0" 40 | string-width "^4.1.0" 41 | term-size "^2.1.0" 42 | type-fest "^0.5.2" 43 | widest-line "^3.1.0" 44 | 45 | camelcase@^5.3.1: 46 | version "5.3.1" 47 | resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" 48 | integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== 49 | 50 | chalk@^2.4.2: 51 | version "2.4.2" 52 | resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" 53 | integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== 54 | dependencies: 55 | ansi-styles "^3.2.1" 56 | escape-string-regexp "^1.0.5" 57 | supports-color "^5.3.0" 58 | 59 | cli-boxes@^2.2.0: 60 | version "2.2.0" 61 | resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-2.2.0.tgz#538ecae8f9c6ca508e3c3c95b453fe93cb4c168d" 62 | integrity sha512-gpaBrMAizVEANOpfZp/EEUixTXDyGt7DFzdK5hU+UbWt/J0lB0w20ncZj59Z9a93xHb9u12zF5BS6i9RKbtg4w== 63 | 64 | color-convert@^1.9.0: 65 | version "1.9.3" 66 | resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" 67 | integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== 68 | dependencies: 69 | color-name "1.1.3" 70 | 71 | color-name@1.1.3: 72 | version "1.1.3" 73 | resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" 74 | integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= 75 | 76 | emoji-regex@^7.0.1: 77 | version "7.0.3" 78 | resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" 79 | integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== 80 | 81 | emoji-regex@^8.0.0: 82 | version "8.0.0" 83 | resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" 84 | integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== 85 | 86 | escape-string-regexp@^1.0.5: 87 | version "1.0.5" 88 | resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" 89 | integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= 90 | 91 | has-flag@^3.0.0: 92 | version "3.0.0" 93 | resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" 94 | integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= 95 | 96 | has-flag@^4.0.0: 97 | version "4.0.0" 98 | resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" 99 | integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== 100 | 101 | is-fullwidth-code-point@^2.0.0: 102 | version "2.0.0" 103 | resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" 104 | integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= 105 | 106 | is-fullwidth-code-point@^3.0.0: 107 | version "3.0.0" 108 | resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" 109 | integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== 110 | 111 | once@^1.4.0: 112 | version "1.4.0" 113 | resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" 114 | integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= 115 | dependencies: 116 | wrappy "1" 117 | 118 | rexrex@^1.3.0: 119 | version "1.3.0" 120 | resolved "https://registry.yarnpkg.com/rexrex/-/rexrex-1.3.0.tgz#430b3574c784300512cb9a123f4ac8284ca4aba6" 121 | integrity sha512-qDrL9XaErX2+bzxdysIeDcJsH4dD8KVhj8cwPjruKpnrK5TVA5nJHk4nWZTh+yInX/kZwv19ea/6qINiyZPrFg== 122 | 123 | string-width@^3.0.0: 124 | version "3.1.0" 125 | resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" 126 | integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== 127 | dependencies: 128 | emoji-regex "^7.0.1" 129 | is-fullwidth-code-point "^2.0.0" 130 | strip-ansi "^5.1.0" 131 | 132 | string-width@^4.0.0, string-width@^4.1.0: 133 | version "4.1.0" 134 | resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.1.0.tgz#ba846d1daa97c3c596155308063e075ed1c99aff" 135 | integrity sha512-NrX+1dVVh+6Y9dnQ19pR0pP4FiEIlUvdTGn8pw6CKTNq5sgib2nIhmUNT5TAmhWmvKr3WcxBcP3E8nWezuipuQ== 136 | dependencies: 137 | emoji-regex "^8.0.0" 138 | is-fullwidth-code-point "^3.0.0" 139 | strip-ansi "^5.2.0" 140 | 141 | strip-ansi@^5.1.0, strip-ansi@^5.2.0: 142 | version "5.2.0" 143 | resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" 144 | integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== 145 | dependencies: 146 | ansi-regex "^4.1.0" 147 | 148 | supports-color@^5.3.0: 149 | version "5.5.0" 150 | resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" 151 | integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== 152 | dependencies: 153 | has-flag "^3.0.0" 154 | 155 | supports-color@^7.0.0: 156 | version "7.0.0" 157 | resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.0.0.tgz#f2392c50ab35bb3cae7beebf24d254a19f880c06" 158 | integrity sha512-WRt32iTpYEZWYOpcetGm0NPeSvaebccx7hhS/5M6sAiqnhedtFCHFxkjzZlJvFNCPowiKSFGiZk5USQDFy83vQ== 159 | dependencies: 160 | has-flag "^4.0.0" 161 | 162 | supports-hyperlinks@^2.0.0: 163 | version "2.0.0" 164 | resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.0.0.tgz#b1b94a159e9df00b0a554b2d5f0e0a89690334b0" 165 | integrity sha512-bFhn0MQ8qefLyJ3K7PpHiPUTuTVPWw6RXfaMeV6xgJLXtBbszyboz1bvGTVv4R0YpQm2DqlXXn0fFHhxUHVE5w== 166 | dependencies: 167 | has-flag "^4.0.0" 168 | supports-color "^7.0.0" 169 | 170 | term-size@^2.1.0: 171 | version "2.1.0" 172 | resolved "https://registry.yarnpkg.com/term-size/-/term-size-2.1.0.tgz#3aec444c07a7cf936e157c1dc224b590c3c7eef2" 173 | integrity sha512-I42EWhJ+2aeNQawGx1VtpO0DFI9YcfuvAMNIdKyf/6sRbHJ4P+ZQ/zIT87tE+ln1ymAGcCJds4dolfSAS0AcNg== 174 | 175 | terminal-link@^2.0.0: 176 | version "2.0.0" 177 | resolved "https://registry.yarnpkg.com/terminal-link/-/terminal-link-2.0.0.tgz#daa5d9893d57d3a09f981e1a45be37daba3f0ce6" 178 | integrity sha512-rdBAY35jUvVapqCuhehjenLbYY73cVgRQ6podD6u9EDBomBBHjCOtmq2InPgPpTysOIOsQ5PdBzwSC/sKjv6ew== 179 | dependencies: 180 | ansi-escapes "^4.2.1" 181 | supports-hyperlinks "^2.0.0" 182 | 183 | type-fest@^0.5.2: 184 | version "0.5.2" 185 | resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.5.2.tgz#d6ef42a0356c6cd45f49485c3b6281fc148e48a2" 186 | integrity sha512-DWkS49EQKVX//Tbupb9TFa19c7+MK1XmzkrZUR8TAktmE/DizXoaoJV6TZ/tSIPXipqNiRI6CyAe7x69Jb6RSw== 187 | 188 | widest-line@^3.1.0: 189 | version "3.1.0" 190 | resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-3.1.0.tgz#8292333bbf66cb45ff0de1603b136b7ae1496eca" 191 | integrity sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg== 192 | dependencies: 193 | string-width "^4.0.0" 194 | 195 | wrappy@1: 196 | version "1.0.2" 197 | resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" 198 | integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= 199 | -------------------------------------------------------------------------------- /packages/use-climate-change-reminder/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var os = require('os') 3 | var fs = require('fs') 4 | var path = require('path') 5 | 6 | /* https://github.com/feross/funding */ 7 | var LIMIT_FILE_PATH = path.join(os.tmpdir(), 'climate-change-message-shown') 8 | var LIMIT_TIMEOUT = 60 * 1000 9 | 10 | function isShownRecently() { 11 | try { 12 | var lastShown = fs.statSync(LIMIT_FILE_PATH).mtime 13 | return Date.now() - lastShown < LIMIT_TIMEOUT 14 | } catch (e) {} 15 | return false 16 | } 17 | 18 | function markShown() { 19 | try { 20 | fs.writeFileSync(LIMIT_FILE_PATH, '') 21 | } catch (err) {} 22 | } 23 | 24 | try { 25 | if (isShownRecently()) return 26 | 27 | if ( 28 | ['silent', 'error'].indexOf(process.env.npm_config_loglevel) > -1 || 29 | (process.env.npm_config_loglevel === 'warn' && !process.version.startsWith('v6.')) 30 | ) 31 | return 32 | 33 | console.log(require('climate-change-reminder')()) 34 | markShown() 35 | } catch (err) { 36 | // pass 37 | } 38 | -------------------------------------------------------------------------------- /packages/use-climate-change-reminder/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "use-climate-change-reminder", 3 | "version": "0.0.7", 4 | "main": "index.js", 5 | "description": "Help fight the climate change crisis by spreading the message.", 6 | "keywords": [ 7 | "climate", 8 | "change", 9 | "is", 10 | "real", 11 | "and", 12 | "accelerating" 13 | ], 14 | "author": "mfix22", 15 | "license": "MIT", 16 | "dependencies": { 17 | "climate-change-reminder": "^0.0.7" 18 | }, 19 | "scripts": { 20 | "postinstall": "node index.js" 21 | }, 22 | "repository": { 23 | "type": "git", 24 | "url": "git+https://github.com/mfix22/use-climate-change-reminder.git" 25 | }, 26 | "homepage": "https://github.com/mfix22/use-climate-change-reminder#readme", 27 | "bin": { 28 | "use-climate-change-reminder": "./index.js" 29 | } 30 | } 31 | --------------------------------------------------------------------------------