├── .github └── FUNDING.yml ├── .gitignore ├── CONTRIBUTING.md ├── DOCUMENTATION.md ├── LICENSE ├── README.md ├── bin └── cli-confetti ├── example └── index.js ├── lib └── index.js └── package.json /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: ionicabizau 2 | patreon: ionicabizau 3 | open_collective: ionicabizau 4 | custom: https://www.buymeacoffee.com/h96wwchmy -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *.swo 3 | *~ 4 | *.log 5 | node_modules 6 | *.env 7 | .DS_Store 8 | package-lock.json 9 | .bloggify/* 10 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # 🌟 Contributing 2 | 3 | Want to contribute to this project? Great! Please read these quick steps to streamline the process and avoid unnecessary tasks. ✨ 4 | 5 | ## 💬 Discuss Changes 6 | Start by opening an issue in the repository using the [bug tracker][1]. Describe your proposed contribution or the bug you've found. If relevant, include platform info and screenshots. 🖼️ 7 | 8 | Wait for feedback before proceeding unless the fix is straightforward, like a typo. 📝 9 | 10 | ## 🔧 Fixing Issues 11 | 12 | Fork the project and create a branch for your fix, naming it `some-great-feature` or `some-issue-fix`. Commit changes while following the [code style][2]. If the project has tests, add one. ✅ 13 | 14 | If a `package.json` or `bower.json` exists, add yourself to the `contributors` array; create it if it doesn't. 🙌 15 | 16 | ```json 17 | { 18 | "contributors": [ 19 | "Your Name (http://your.website)" 20 | ] 21 | } 22 | ``` 23 | 24 | ## 📬 Creating a Pull Request 25 | Open a pull request and reference the initial issue (e.g., *fixes #*). Provide a clear title and consider adding visual aids for clarity. 📊 26 | 27 | ## ⏳ Wait for Feedback 28 | Your contributions will be reviewed. If feedback is given, update your branch as needed, and the pull request will auto-update. 🔄 29 | 30 | ## 🎉 Everyone Is Happy! 31 | Your contributions will be merged, and everyone will appreciate your effort! 😄❤️ 32 | 33 | Thanks! 🤩 34 | 35 | [1]: /issues 36 | [2]: https://github.com/IonicaBizau/code-style -------------------------------------------------------------------------------- /DOCUMENTATION.md: -------------------------------------------------------------------------------- 1 | ## Documentation 2 | 3 | You can see below the API reference of this module. 4 | 5 | ### `cliConfetti(opts, cb)` 6 | Confetti in your terminal. 7 | 8 | #### Params 9 | 10 | - **Object** `opts`: The options to be passed to `cli-snow` 11 | - **Function** `cb`: The callback function. 12 | 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016-25 Ionică Bizău (https://ionicabizau.net) 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 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | # `$ cli-confetti` 21 | 22 | [![Support me on Patreon][badge_patreon]][patreon] [![Buy me a book][badge_amazon]][amazon] [![PayPal][badge_paypal_donate]][paypal-donations] [![Ask me anything](https://img.shields.io/badge/ask%20me-anything-1abc9c.svg)](https://github.com/IonicaBizau/ama) [![Version](https://img.shields.io/npm/v/cli-confetti.svg)](https://www.npmjs.com/package/cli-confetti) [![Downloads](https://img.shields.io/npm/dt/cli-confetti.svg)](https://www.npmjs.com/package/cli-confetti) [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/@johnnyb?utm_source=github&utm_medium=button&utm_term=johnnyb&utm_campaign=github) 23 | 24 | Buy Me A Coffee 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | > Confetti in your terminal. 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | [![cli-confetti](http://i.imgur.com/cXWVC9b.gif)](#) 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | ## :cloud: Installation 53 | 54 | You can install the package globally and use it as command line tool: 55 | 56 | 57 | ```sh 58 | # Using npm 59 | npm install --global cli-confetti 60 | 61 | # Using yarn 62 | yarn global add cli-confetti 63 | ``` 64 | 65 | 66 | Then, run `cli-confetti --help` and see what the CLI tool can do. 67 | 68 | 69 | ``` 70 | $ cli-confetti --help 71 | Usage: cli-confetti [options] 72 | 73 | Confetti in your terminal. 74 | 75 | Options: 76 | -c, --chars Characters to use in the animation. 77 | -d, --duration Duration of the animation. Default: forever. 78 | -h, --help Displays this help. 79 | -v, --version Displays version information. 80 | 81 | Examples: 82 | $ cli-confetti -d 3 # Three second animation 83 | $ cli-confetti -c '<3' -c ':*' -c ':x' # Specify the characters to use 84 | 85 | Documentation can be found at https://github.com/IonicaBizau/cli-confetti#readme. 86 | ``` 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | ## :clipboard: Example 101 | 102 | 103 | 104 | Here is an example how to use this package as library. To install it locally, as library, you can use `npm install cli-confetti` (or `yarn add cli-confetti`): 105 | 106 | 107 | 108 | ```js 109 | const cliConfetti = require("cli-confetti") 110 | , CliUpdate = require("cli-update") 111 | ; 112 | 113 | cliConfetti({}, function (err, c) { 114 | if (err) throw err; 115 | CliUpdate.render(c); 116 | }); 117 | ``` 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | ## :question: Get Help 131 | 132 | There are few ways to get help: 133 | 134 | 135 | 136 | 1. Please [post questions on Stack Overflow](https://stackoverflow.com/questions/ask). You can open issues with questions, as long you add a link to your Stack Overflow question. 137 | 2. For bug reports and feature requests, open issues. :bug: 138 | 3. For direct and quick help, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket: 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | ## :memo: Documentation 147 | 148 | For full API reference, see the [DOCUMENTATION.md][docs] file. 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | ## :yum: How to contribute 162 | Have an idea? Found a bug? See [how to contribute][contributing]. 163 | 164 | 165 | ## :sparkling_heart: Support my projects 166 | I open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously, 167 | this takes time. You can integrate and use these projects in your applications *for free*! You can even change the source code and redistribute (even resell it). 168 | 169 | However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it: 170 | 171 | 172 | - Starring and sharing the projects you like :rocket: 173 | - [![Buy me a book][badge_amazon]][amazon]—I love books! I will remember you after years if you buy me one. :grin: :book: 174 | - [![PayPal][badge_paypal]][paypal-donations]—You can make one-time donations via PayPal. I'll probably buy a ~~coffee~~ tea. :tea: 175 | - [![Support me on Patreon][badge_patreon]][patreon]—Set up a recurring monthly donation and you will get interesting news about what I'm doing (things that I don't share with everyone). 176 | - **Bitcoin**—You can send me bitcoins at this address (or scanning the code below): `1P9BRsmazNQcuyTxEqveUsnf5CERdq35V6` 177 | 178 | ![](https://i.imgur.com/z6OQI95.png) 179 | 180 | 181 | Thanks! :heart: 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | ## :dizzy: Where is this library used? 199 | If you are using this library in one of your projects, add it in this list. :sparkles: 200 | 201 | - `tcbd` 202 | - `zeta-rps-game` 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | ## :scroll: License 215 | 216 | [MIT][license] © [Ionică Bizău][website] 217 | 218 | 219 | 220 | 221 | 222 | 223 | [license]: /LICENSE 224 | [website]: https://ionicabizau.net 225 | [contributing]: /CONTRIBUTING.md 226 | [docs]: /DOCUMENTATION.md 227 | [badge_patreon]: https://ionicabizau.github.io/badges/patreon.svg 228 | [badge_amazon]: https://ionicabizau.github.io/badges/amazon.svg 229 | [badge_paypal]: https://ionicabizau.github.io/badges/paypal.svg 230 | [badge_paypal_donate]: https://ionicabizau.github.io/badges/paypal_donate.svg 231 | [patreon]: https://www.patreon.com/ionicabizau 232 | [amazon]: http://amzn.eu/hRo9sIZ 233 | [paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RVXDDLKKLQRJW 234 | -------------------------------------------------------------------------------- /bin/cli-confetti: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | "use strict"; 3 | 4 | const Tilda = require("tilda") 5 | , CliUpdate = require("cli-update") 6 | , cliConfetti = require("..") 7 | ; 8 | 9 | new Tilda(`${__dirname}/../package.json`, { 10 | options: [ 11 | { 12 | name: "duration", 13 | opts: ["d", "duration"], 14 | description: "Duration of the animation. Default: forever.", 15 | default: -1, 16 | type: Number 17 | }, 18 | { 19 | name: "chars", 20 | opts: ["c", "chars"], 21 | description: "Characters to use in the animation.", 22 | type: Array 23 | } 24 | ], 25 | examples: [ 26 | "cli-confetti -d 3 # Three second animation" 27 | , "cli-confetti -c '<3' -c ':*' -c ':x' # Specify the characters to use " 28 | ] 29 | }).main(action => { 30 | const startTime = new Date() 31 | , duration = action.options.duration.value 32 | 33 | cliConfetti({ 34 | chars: action.options.chars.value 35 | }, function (err, c) { 36 | if (err) throw err; 37 | if (duration !== -1 && (new Date() - startTime) / 1000 > duration) { 38 | return process.exit(0) 39 | } 40 | CliUpdate.render(c); 41 | }); 42 | }); 43 | -------------------------------------------------------------------------------- /example/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const cliConfetti = require("../lib") 4 | , CliUpdate = require("cli-update") 5 | ; 6 | 7 | cliConfetti({}, function (err, c) { 8 | if (err) throw err; 9 | CliUpdate.render(c); 10 | }); 11 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const cliSnow = require("cli-snow") 4 | , flatColors = require("flat-colors") 5 | , couleurs = require("couleurs") 6 | ; 7 | 8 | const colors = flatColors.colors.map(c => c[3]); 9 | 10 | /** 11 | * cliConfetti 12 | * Confetti in your terminal. 13 | * 14 | * @name cliConfetti 15 | * @function 16 | * @param {Object} opts The options to be passed to `cli-snow` 17 | * @param {Function} cb The callback function. 18 | */ 19 | module.exports = function cliConfetti (opts, cb) { 20 | opts = opts || {}; 21 | opts.chars = (opts.chars || [".", "*", "@", "#", "$", "%", "<3", "&", "*", ":D", ":)", ":-)", ";)", ":>"]).map((c, i) => { 22 | return couleurs(c, colors[i]).toString() 23 | }); 24 | cliSnow(opts, cb); 25 | }; 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "bin": { 3 | "cli-confetti": "bin/cli-confetti" 4 | }, 5 | "name": "cli-confetti", 6 | "description": "Confetti in your terminal.", 7 | "keywords": [ 8 | "cli", 9 | "confetti", 10 | "in", 11 | "your", 12 | "terminal" 13 | ], 14 | "license": "MIT", 15 | "version": "1.1.1", 16 | "main": "lib/index.js", 17 | "scripts": { 18 | "test": "echo \"Error: no test specified\" && exit 1" 19 | }, 20 | "author": "Ionică Bizău (https://ionicabizau.net)", 21 | "files": [ 22 | "bin/", 23 | "app/", 24 | "lib/", 25 | "dist/", 26 | "src/", 27 | "scripts/", 28 | "resources/", 29 | "menu/", 30 | "cli.js", 31 | "index.js", 32 | "index.d.ts", 33 | "package-lock.json", 34 | "bloggify.js", 35 | "bloggify.json", 36 | "bloggify/" 37 | ], 38 | "repository": { 39 | "type": "git", 40 | "url": "git+ssh://git@github.com/IonicaBizau/cli-confetti.git" 41 | }, 42 | "bugs": { 43 | "url": "https://github.com/IonicaBizau/cli-confetti/issues" 44 | }, 45 | "homepage": "https://github.com/IonicaBizau/cli-confetti#readme", 46 | "dependencies": { 47 | "cli-snow": "^1.3.3", 48 | "cli-update": "^3.2.0", 49 | "couleurs": "^6.0.3", 50 | "flat-colors": "^3.3.3", 51 | "tilda": "^4.3.1" 52 | }, 53 | "blah": { 54 | "ex_img": "http://i.imgur.com/cXWVC9b.gif" 55 | } 56 | } --------------------------------------------------------------------------------