DEV Community

maik pleines
maik pleines

Posted on

I published a NPM package


Hi Everyone!

Before I get started with explaining how I made and published a npm package, I would like to introduce myself (since this is also my first Post here):

Iยดm Maik, a 24-year-old developer from Germany. I like building Applications in Javascript, mostly React. If you want to reach out, you can find me on GitHub or Twitter. If you like, you can also visit my Portfolio for further information.

How I published a NPM package

I always wanted to publish a NPM package, mainly because I was interested in how it works. I stumbled across create-react-library, which looked very promising to me. You can start writing your package like with create-react-app, and test it directly in another /example folder. All the building etc. is handled by create-react-library.

I decided to make a small toast message package, which lets users create toast messages with a single function. So I wrote all the code for it and tested in directly in the /example folder:

import React from 'react'

import { toasty } from 'web-toasty'

const App = () => {
  toasty('this is a toast message โœ…', 1000)
  return <div></div>

export default App

After testing it, I only had to publish it to NPM, which is very simple. You just have to run

npm publish

in the root directory.

So, here it is, my first NPM package:


I highly appreciate any feedback!

Top comments (2)

sharmakushal profile image
Kushal sharma

Congratulations for the first npm package

maikcodes profile image
maik pleines

Thank you Kushal!