PNPM: Because to work more flexible we start from the bottom
--
pnpm is a nodejs
package manager which has as its main objective to reduce the number of packages installed on your local machine and to speed up the installation of packages.
How does all this work?
To do this, pnpm
, uses two really simple concepts but are not so easy to implement:
- Sharing of the dependencies. All the dependencies will be installed in a unique store and linked (hard or soft, depending on the package) in your
node_modules
folder, this means that if you use the same package (and version) on 100 projects you will install it just once. - Light package updates. When you update a package, using the
pnpm update
command, only the files changed inside the package will be saved in the store, so you won’t have a redundant and complete folder for all your versions of the same package but a complete version and the diff of the new version.
In the end, pnpm
changes the structure inside the node_modules
folder to better manage symlinks and other magic stuff but all of this is transparent to you. You will be able to use your packages inside your code as always at the cost of using pnpm
instead of using npm
or yarn
How to install it?
To install pnpm
you have two main ways:
- Standalone: using
curl
,wget
,brew
, etc… - As an npm package, like yarn, using the
npm install -g pnpm
command
I advise you to install it as a standalone package, but it’s up to you, all the references on how to install it can be found at this link:
What changes from npm?
At the usage level, there are no differences, in addition to having to remember to use pnpm
instead of npm
(for me is very difficult because the names are really too similar, maybe could be a great idea to create a bash alias?), otherwise, the CLI is deliberately so similar. You will have the opportunity to: