loading...

I published a NPM package

maikcodes profile image maik pleines 惻2 min read

Introduction

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:

webtoasty

I highly appreciate any feedback!

Posted on May 2 by:

maikcodes profile

maik pleines

@maikcodes

Web Developer from Germany. I love everything Javascript. Mostly coding in React.

Discussion

markdown guide
 

Congratulations for the first npm package