DEV Community

yanir manor
yanir manor

Posted on

5

PNPM install smart

Let's think about installing and node module.
Installation takes some time, and you will find some shared packages on a local computer in many projects.
Consider the cost of storage and processing for the CI docker virtual machine.
So how can we get some speed and efficiency?

pnpm for the rescue. pnpm is a fast, disk space-efficient package manager.
pnpm will be stored in a content-addressable store.

In the video below you can see the comparison between npm and pnpm

What pnpm gives:

  1. If you depend on different versions of the dependency, only the files that differ are added to the store. For instance, if it has 100 files, and a new version has a change in only one of those files, pnpm update will only add 1 new file to the store, instead of cloning the entire dependency just for the singular change.

  2. All the files are saved in a single place on the disk. When packages are installed, their files are hard-linked from that single place, consuming no additional disk space. This allows you to share dependencies of the same version across projects.

As a result, you save a lot of space on your disk proportional to the number of projects and dependencies, and you have a lot faster installations!

Also, pnpm has some features. You can create a workspace to unite multiple projects inside a single repository.

Next, I will write with the combination using pnpm with turborepo.

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay