DEV Community

Cover image for Creating your first npm package

Creating your first npm package

Dan Vega on February 12, 2019

This weekend I started working on my first ever npm package. I can't believe for how long I have been writing code that I never bothered to create ...
Collapse
 
dance2die profile image
Sung M. Kim

This is an article I wish I had read before struggling so long to publish an NPM package 👍

Collapse
 
therealdanvega profile image
Dan Vega

Aww thank you for the kind words :)

Collapse
 
jvarness profile image
Jake Varness

Totes gonna use wrap-with-poo in my next package.

Collapse
 
juanfrank77 profile image
Juan F Gonzalez

As always you bringing in the real value Dan, thanks a lot for this! Been wanting to do this for quite some time but it seemed so daunting

Collapse
 
therealdanvega profile image
Dan Vega

You are too kind Juan. Thank you, my friend :) It does seem pretty overwhelming until you realize it isn't :)

Collapse
 
gifco profile image
GifCo

Ok this is great and all but it's 2019 and your example would be most suitable for front end use so why would you NOT even mention that thia should be published as an ESM not common.js. or ideally both.

Collapse
 
therealdanvega profile image
Dan Vega

Great questions. I just thought this was a good starting point. It's hard to talk about something new and not include everything the reader might need. I thought I would keep this simple and stick to the basics but I do appreciate your feedback. Thank you, Giff.

Collapse
 
chinmayj93 profile image
Chinmay Joshi

Timing of your blog couldn't be better. I'm struggling with some problems, and going to refer this to solve the issues.

Thanks!!!

Collapse
 
therealdanvega profile image
Dan Vega

Great to hear. Let me know if you run into any issues, I am always looking for something to write about.

Collapse
 
_mertsimsek profile image
Mert Simsek • Edited

Thank you for article, that's a spirit :)

Collapse
 
feralamillo profile image
Feralamillo

Great tutorial!! I followed and have my first npm package live: npmjs.com/package/check-osaurus

thank you very much for the tips. I wonder if there is a better way to connect directly from github instead of having to do it manually.

Collapse
 
apol0x profile image
Apol0x

Thank you so much for the post,I thought a lot of times inform myself about this, and you explain it very clear

Collapse
 
therealdanvega profile image
Dan Vega

Thank you :)

Collapse
 
craigiswayne profile image
Craig Wayne

Thank you Dan!

Been meaning to actually start packaging our angular components into independent npm packages.

Didn't know where to start! So thank you so much for this 🥳

Collapse
 
antonreshetov profile image
Anton Reshetov

It is very strange to start with version 0.0.1, that is, with fix bug

Collapse
 
therealdanvega profile image
Dan Vega

Why is it strange? I am saying that this is the very first release of my plugin. It has some work to do before I consider it a stable 1.0 release.

Collapse
 
antonreshetov profile image
Anton Reshetov

Because it is incorrect to start versioning from the version which is intended for a fix of any bug
semver.org/#how-should-i-deal-with...

Thread Thread
 
therealdanvega profile image
Dan Vega

Oh, I thought it was at 0.1.0. Yes, I would agree with that. Will update, thank you!

Collapse
 
avinashd10 profile image
Avinashd

Hi, thank you for simplification example on publishing our own package to npm.

Collapse
 
panthablack profile image
panthablack

Thanks for this - saved me loads of time and nudged me to publish my first package! Nice one.

Collapse
 
horiyomi profile image
horiyomi

Thanks, this is really helpful

Collapse
 
keeeeith profile image
Keith Burgie

Made an account here just to say thanks! This was very helpful.

Collapse
 
luucamay profile image
Lupe 🇧🇴

Amazing!

Collapse
 
garryho7 profile image
💚🦀A Nice Guy ;) (#BLM)🦀💚 #ReplGang

You should include /types

Collapse
 
vikasmagar512 profile image
Vikas Magar

Hey, thanks for this awesome Tut. Keep writing :)

Collapse
 
mxrcochxvez profile image
Marco Chavez

Just wanted to thank you! I was able to write my first npm package because of this!

Collapse
 
monicat profile image
Monica Macomber

I’ll need to do this soon at work, saving the article for reference 🙏 thanks!

Collapse
 
strahinjalak profile image
Strahinja Laktovic

Thanks for the article Dan, really well written and comprehensive. I look forward to reading your sequel about adding testing to the package !

Collapse
 
pedrohenriquebr profile image
pedrohenriquebr

I read it before I published my "@pedrobr/autonomous" package! thank you man !

Collapse
 
jwp profile image
John Peters

Thanks Dan Vega!

Collapse
 
moyarich profile image
Moya Richards

nice tutorial

Collapse
 
realsaeedhassani profile image
Saeed Hassani Borzadaran

Thanks :)

Collapse
 
rrakso profile image
rrakso • Edited

I've just downloaded verdaccio.org/ so I can push my own packages to private online registry! <3