I created my first npm package

Introduction

My name is Erick, I am a self-taught developer from Mexico, while I mainly do Front-end development, I often make Discord bots for fun, and occasionally get commissions from server owners to make their own custom bot. I’m always…


This content originally appeared on DEV Community and was authored by Erick Mack

Introduction

My name is Erick, I am a self-taught developer from Mexico, while I mainly do Front-end development, I often make Discord bots for fun, and occasionally get commissions from server owners to make their own custom bot. I'm always open to chatting about Discord bots or web dev stuff so feel free to contact me on Twitter.
Why I made this package:

  • To learn something new.
  • To make my life easier by not having to go back to old projects trying to remember what I did.

create-discordjs-app

What is it?

create-discordjs-app is a simple npm package that automatically generates a discord.js bot template, it includes things like:

  • Command handler
  • Dynamic help command
  • Command Cooldowns
  • Command Permissions
  • ESLint
  • Command Categories

Why not make it a repo?

Mainly 2 reasons:

  • I wanted to automatically install dependencies after generating the files.
  • I wanted to share it with others that might find it useful, and the name is more memorable than a GitHub link.

But like I mentioned earlier, I also wanted to learn something new, and this allowed me to learn how to publish my own npm package, handle versioning more easily, make it automatically download the dependencies needed, and many other things I got to learn from the community's feedback.

Why discord.js?

I am aware of the problems discordjs has and that there are other packages out there that are better optimized for memory use, but I decided to go with discord.js because it's the most popular one out there and the truth is:
Most people are perfectly fine with discord.js, yes I know other libraries might use less memory, and they don't cache anything you don't ask them to and this is great for your bot that needs to be optimized as much as possible because it's in thousands of servers, but most bots out there aren't like that, most bots are in a few servers at a time and these optimizations are not needed.
For beginners or an average user who will have their bot in only a few servers, discord.js is a great option, you can easily find answers to questions, find people that use it, and detailed guides on how to get started.

How can I use it?

If you're interested in using it for your next project you can install the package globally on your machine and use it

npm i create-discordjs-app -g
create-discordjs-app

or you can use it with npx without having to install it globally

npx create-discordjs-app

After that, you will be prompted with a series of questions like your project name, author, license, and bot prefix.
Once the files are generated you can go into the new folder that was created and in the .env file enter your discord token, and then you can start the bot with:

npm start

Downloads in the first week

To my surprise, the npm package was downloaded 300+ times in the first week of being published, thanks to this I got many useful recommendations on how to improve it, things to add, things to remove, and of course the pesky little bugs that went unnoticed during development.
screenshot of weekly downloads shows 357

Plans and how to get involved

My plans for this package are to polish it as much as I can and to add more options that allow customizing the project to fit your needs and be as useful as possible to as many people as possible.
If you're interested in working on or requesting bug fixes, new features, or better code structure, check out the GitHub page:
https://github.com/erickmack/create-discordjs-app
or contact me on Twitter
@Eriickmack


This content originally appeared on DEV Community and was authored by Erick Mack


Print Share Comment Cite Upload Translate Updates
APA

Erick Mack | Sciencx (2021-03-17T14:21:02+00:00) I created my first npm package. Retrieved from https://www.scien.cx/2021/03/17/i-created-my-first-npm-package/

MLA
" » I created my first npm package." Erick Mack | Sciencx - Wednesday March 17, 2021, https://www.scien.cx/2021/03/17/i-created-my-first-npm-package/
HARVARD
Erick Mack | Sciencx Wednesday March 17, 2021 » I created my first npm package., viewed ,<https://www.scien.cx/2021/03/17/i-created-my-first-npm-package/>
VANCOUVER
Erick Mack | Sciencx - » I created my first npm package. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/03/17/i-created-my-first-npm-package/
CHICAGO
" » I created my first npm package." Erick Mack | Sciencx - Accessed . https://www.scien.cx/2021/03/17/i-created-my-first-npm-package/
IEEE
" » I created my first npm package." Erick Mack | Sciencx [Online]. Available: https://www.scien.cx/2021/03/17/i-created-my-first-npm-package/. [Accessed: ]
rf:citation
» I created my first npm package | Erick Mack | Sciencx | https://www.scien.cx/2021/03/17/i-created-my-first-npm-package/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.