Skip to content

This is a POC that I conducted with the objective of investigating the advantages and disadvantages of PNPM as a package manager.

Notifications You must be signed in to change notification settings

mdominguez56/PNPM-POC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

PNPM POC

The purpose of this repository is to investigate the advantages and disadvantages of using PNPM as a package manager.

All documentation written below is based on existing documentation on https://pnpm.io/ and other websites.

Why use pnpm?

  • Saving disk space
  • Boosting installation speed
  • More security
  • Offline mode

You can read more about the motivations to use pnpm here:

How does it work?

One of the main features of PNPM is Creating a non-flat node_modules directory.

non-flat

When installing dependencies with npm or Yarn Classic, all packages are hoisted to the root of the modules directory. As a result, source code has access to dependencies that are not added as dependencies to the project.

By default, pnpm uses symlinks to add only the direct dependencies of the project into the root of the modules directory.

Installation

Install pnmpm with npm

  npm install -g pnpm

For more installation instructions you can read the installation guide found at: : https://pnpm.io/es/installation

Installation times / Benchmarks

Time it takes to install Chakra-UI:

  • NPM: 5.15s user 2.02s system 31% cpu 22.981 total
  • YARN: 5.04s user 3.17s system 22% cpu 37.268 total
  • PNPM: 3.97s user 3.10s system 64% cpu 10.896 total

Time it takes to install Express:

  • NPM: 0.59s user 0.10s system 34% cpu 2.003 total
  • YARN: 1.36s user 0.51s system 33% cpu 5.544 total
  • PNPM: 0.74s user 0.19s system 39% cpu 2.370 total

For more information about bencharks between pnpm, npm and yarn you can visit the following link: https://pnpm.io/benchmarks

For other comparisons with NPM and YARN see the information found here: https://pnpm.io/feature-comparison

Differences in node_modules folder structure

NPM node_modules folder:

npm

YARN node_modules folder:

yarn

PNPM node_modules folder:

pnpm

Other features

Filtering

Filtering allows you to restrict commands to specific subsets of packages.

pnpm supports a rich selector syntax for picking packages by name or by relation.

Selectors may be specified via the --filter (or -F) flag:

  pnpm --filter <package_selector> <command>

To learn how to use the filter function, see the following link: https://pnpm.io/filtering

Workspaces

pnpm has built-in support for monorepositories (AKA multi-package repositories, multi-project repositories, or monolithic repositories). You can create a workspace to unite multiple projects inside a single repository.

A workspace must have a pnpm-workspace.yaml file in its root. A workspace also may have an .npmrc in its root.

Here are a few of the most popular open source projects that use the workspace feature of pnpm:

workspaces

To learn more about the implementation of workspaces, you can see the following link: https://pnpm.io/workspaces

License

MIT

About

This is a POC that I conducted with the objective of investigating the advantages and disadvantages of PNPM as a package manager.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published