Articles

Publishing packages that can be used in browsers and Node

When you create a package for others to use, you have to consider where your user will use your package. Will they use it in a browser-based environment (or frontend JavaScript)? Will they use it in Node (or backend JavaScript)? Or both?

If you want to create a package that’s usable in both browsers and Node, this article is here to help.

You’ll learn:

  1. How to write packages for use in browsers
  2. How to write packages for use in Node
  3. How to publish your packages for use in both browsers and Node

How to ignore files from your npm package

You can decide what files people get when they download your package in three ways:

  1. With the .gitignore file
  2. With the .npmignore file
  3. With the files property

We’ll look at each method and discuss which methods you should (or shouldn’t) be using.

The best time to npm init

When should you npm init?

Most developers run npm init right after creating and navigating into a new project.

It makes sense to npm init at the start of the project because we use npm to download dependencies. Once we npm init, we can begin downloading (and saving) our dependencies.

For most projects, this workflow works.

But if you’re creating an open source project, the best time to npm init is slightly later. If you npm init right after creating and navigating into the project, you’ll miss out a few things.

How to publish packages to npm (the way the industry does things)

It’s simple to publish a package onto npm. There are two steps:

  1. Create your package.
  2. Publish the package.

But publishing packages the way the industry does it? Not so simple. There are more steps. We’ll go through what steps are required, and I’ll show you an easy way to publish and update your package.

How to use JSDelivr

The most newbie-friendly way to add a library to a project is to:

  1. Search for the library
  2. Look for the source file
  3. Copy the source file
  4. Paste what you copied into the project.

This works, but it’s a painful process. It easier if you use CDNs like JSDelivr.

My CSS reset

Many frontend developers begin styling their websites with Normalize. Some developers have personal preferences they add on to Normalize.css. I have my preferences too.

In this article, I want to share these preferences with you. personal CSS reset (that I use in addition to Normalize.css) with you.

Setting up my new Mac (Part 2—the migration process)

Setting up a new Mac is painful. Here are some of the things I have to do:

  1. Install all 47 applications I use every day.
  2. Provide the right credentials for each application.
  3. Change macOS default settings to the ones I like.
  4. Set up coding configurations.
  5. Move files from the old Mac to the new one.

I estimate at least a three day’s worth of work (downloading things and waiting for them to download 😴) if I have to install everything manually.

But I was able to set my computer up in hours (automatically) thanks to dotfiles.

Setting up my new Mac (Part 1—the apps I use)

My first task in 2019 is to get a new computer. I didn’t want to change computers, but my old one gave way and I had no choice 😭.

Since I’m already switching computers, I thought it’ll be interesting to share the apps I use on a daily basis.

I hope you find some of them interesting!

RSS and Tags are here!

Many people wanted two things at Zellwk.com:

  1. An RSS feed (to get updates without going through emails).
  2. An easier way to browse the articles I created.

I finally found the chance to provide these features!

Hold on while i sign you up…

🤗
Woohoo! You’re in!
Now, hold on while I redirect you.