Introduction

Welcome to NPM Package!

NPM is a database (storage) for thousands of packages. Developers use it to share, manage, find, and install libraries.

An icon of a key1

Packages are sometimes called libraries, plugins, frameworks, or tools. It is a directory (or project) with a package.json file for recording information about it.

Publishing NPM packages provides an effective means to share code with others and enhance your development skills. It is an important step in contributing to the developer community and demonstrating a range of competencies, including:

  • communication skills
  • collaboration skills
  • organizational skills
  • technical skills
  • documentation skills
  • problem-solving skills

Becoming an NPM package publisher is a unique way to deliver a finished product that others can use as part of or as the main component of their apps.

This beginner-friendly book discusses everything you need to know to create, test, and publish NPM packages like a pro.

How This Book Can Help You

The best way to learn is through progressive practice. In other words, the easiest way to become a proficient package publisher is to proactively build NPM plugins—rather than merely reading or watching videos about them.

Accordingly, this book adopts a project-oriented approach to maximize hands-on practice while teaching the fundamental concepts of publishing NPM packages.

To get the most out of this book, open your text editor (like VS Code) and code along as you read. This way, you’ll avoid getting stuck in “Tutorial Hell.”

The Roadmap

The main project in this book is a Tweet Button, which you can make as simple or advanced as you prefer.

Don’t let the project types scare you off! You are in for an exciting ride, where you will learn the fundamental concepts needed to publish any NPM package. So, give it a chance.

Dependencies

It is strongly recommended to use the exact dependency versions specified in this book. This practice minimizes the likelihood of encountering bugs introduced by newer versions.

After finishing this book’s lessons, you can upgrade the dependencies to the latest version. If the bump (update) causes a bug, search online or the package’s community for the appropriate fix.

Prerequisite

Knowing the basics of Git, GitHub, React, and TypeScript will make it easier to learn how to publish NPM packages. It’s helpful to be familiar with these tools before you start.

Questions and Comments

If you have questions or comments about this book, email contact@codesweetly.com or send me a direct message on Twitter (@oluwatobiss).

Let’s Get It Started!

The next chapter will show you how to set up the project.