First NPM Package
Yesterday I developed and published my first NPM package, the armenian-names package. This package provides the following useful functions:
getMaleNames() getFemaleNames() getAllNames() getRandomMaleName() getRandomFemaleName() getRandomName()
Who Would Benefit from armenian-names
?
People developing applications that need to incorporate Armenian given names, whether boy or girl names, as part of their data can benefit from importing this package into their project.
Why I Built It
- I wanted to build something fun that I'm interested in. I'm ethnically Armenian and preserving my ethnic identity is something I value. I also find picking names for babies to be a fun thing to do.
- I wanted to learn a new technology. Learning how to build and publish an NPM package was always something I had in the back burner and finally got to do.
- I wanted to add something to the incredibly vast universe of resources available for developers that is the Internet. This is one contribution I made, giving back to this mind-blowing ecosystem.
- This is a project I could showcase in a future job interview or technical talk.
What I Learned
- Building an NPM package is a very easy process. The steps are:
mkdir <your-npm-package-name>
.cd <your-npm-package-name>
.git init
.npm init
.- Create an
index.js
. - In
index.js
, you provide data and export function(s) to make that data available to the end user in someway(s). npm link
to make it globally available on your machine for testing.- Create another project to test it.
npm link <your-npm-package-name>
to add it as a dependency and use it in that test project.- When ready,
npm login
and thennpm publish
.
- There are currently 2,459,633 packages on npm. My armenian-names package is one of those 2,459,633 packages.