Whenever I install any npm package in my project, I always worry about disk space. Sometimes, I think about some centralized kind of thing, where I dont need to install repetitive npm packages in my projects, and I can reference them from centralized location. Lets say, I have 100 projects on 256 GB disk space, it means I have 100 copies of each npm package in my disk.
Every byte saved on disk can be used for something else than libraries code ___ when you have limited disk space on your machine.
I have been using npm for a long time on my laptop, and I think, there could be one way to centralize the code libraries storage into a central place, and share it with all the projects you work on.
So, I googled for replacement of npm package manager, and learned about pnpm package manager. I would like to share my findings and summarize it with you. I am still not an expert in using pnpm so I will try to put different supporting links in this post for my audience.
Lot of talks, now lets come to the point.
What Is PNPM
pnpm is an alternate package manager for Node.js. It is a drop in replacement for npm, but faster and most efficient.
PNPM is fast, disk space efficient package manager. __ pnpm.js.org
As said above, It is basically a drop in replacement for npm, which means that once you install it, you can invoke pnpm install to download a project dependencies, and all will work transparently for you.
So, this is the solution of my worries, which I mentioned above to save disk space for 100 projects having duplicate copies of npm packages in each project. Now, using pnpm, packages will be installed once globally, and then reference that first install across all of your projects.
For each version of package, there will be only one copy kept on the disk.
Hurry! I can now save gigabytes of disk space using PNPM.
How Fast Is the PNPM
Ok, cool, I said it is fast, but how fast __ a leading question. Let me share its performance benchmark link.
Check benchmark link here
Whos Using this
pnpm is specially used in those companies where there is a need to maintain a large number of projects with the same dependencies. Microsoft is one of those company.
Photo : pnpm.js.org
Read More About PNPM
This post is just a brief introduction of pnpm and show a little comparison with npm, there are no technical details about using pnpm. So, I am going to share the links below.
pnpm GitHub repo
pnpm.js.org
pnpm faq
Summary
Whatever the outcome of this race is, I do think that npm is a safer choice over all, but pnpm might be a better choice for some use cases.
Further Reading
Running GraphQL Server Using Node.JS and Express on Linux Hosting Server
Destructuring In JavaScript Can Make Your Code Short And Cleaner
This Is Why Learning New JavaScript ES6 Syntax Is So Famous!