DEV Community

Cover image for Writing A Package
Ray Arayilakath
Ray Arayilakath

Posted on • Edited on

Writing A Package

Writing A Package

By: Rayhan Arayilakath

Recently I published version 1.0.3 of a small, yet fulfilling wrapper for the API of my favorite IDE and coding forum Repl.it. It was the first ever package that I wrote and personally I found it to be an interesting experience.

I always thought people who made packages had a certain flair about them, and the rest of us using packages were indebted forever to their hours of laborious work so that we can pad our text in ASNI sequences or poop emojis!

When I realized that NPM actually allowed user’s to submit packages for free, I knew I had to make one and coincidently I was also sick and tired of writing a node-fetch function each time I needed to query a person’s cycles (internet points, think reputation on StackOverFlow) on Repl.it. Putting two plus two together I realized this was the perfect idea for a package, so I set out on my quest!

I studied a bit on package structure, increased my knowledge on module exports, and also found out all sorts of GraphQL Queries Repl.it uses so I Frankensteined a package together and published it to NPM.

It was a mess.

Half the time, I was returned an undefined value and I had so many functions attached to one singular variable I lost track of them! I had a sinking feeling in my gut that maybe package dev wasn’t for me, yet I still tried!

I scratched the original package and I created a new idea that I didn’t see in many other packages that I used past, involving creating a class for each user, post, comment or any object I wanted data on. Sure enough, my tests ensured that it worked all the time and surprisingly it was awfully simple to use. Quite honestly, I became really proud of my first package.

As I publish this, I am writing an official documentation for it before letting the public see it (however some fellow Repler’s have already found it xD) and after that I have a short by sweet roadmap to follow, perhaps making my package one of the more complete Repl.it API packages available. Time will tell, but in the meantime check it out. Happy coding and see you next time! ~ Ray

Top comments (2)

Collapse
 
potentialstyx profile image
PotentialStyx

Good job on the package!

Collapse
 
zuhdihacker1 profile image
ZDev1

Amazing!
My own package: npmjs.com/package/shift-db