Standardising on pnpm #445
Replies: 13 comments 9 replies
-
https://github.com/snyk-tech-services/snyk-pnpm-github-action has been archived and Snyk are not committing to support |
Beta Was this translation helpful? Give feedback.
-
Have we thought about the long term viability of pnpm? Will it still be around (or the best thing) in a year or 2? Compared to the long term viability of plain old npm? |
Beta Was this translation helpful? Give feedback.
-
pnpm is on version 7 and predates yarn, and merged 373 PRs in the last year, so I would say it's under active development. aside from general performance issues, the problem is that npm still hoists packages, which is the behaviour we are trying to move away from. they do tend to adopt features from 3rd party installers (eventually), so they may drop hoisting at some point. but for now npm is slower and doesn't solve the hoisting issue. (npm has always felt to me like a best-efforts package manager – node needs something to get you going with package registries but it's never been as good as 3rd party options (once they appeared)). |
Beta Was this translation helpful? Give feedback.
-
Sounds alright to me then. |
Beta Was this translation helpful? Give feedback.
-
From Snyk, the package health scores are also quite telling: |
Beta Was this translation helpful? Give feedback.
-
Vulnerability monitoring for pnpm is supported by https://github.com/google/osv-scanner#input-a-lockfile. |
Beta Was this translation helpful? Give feedback.
-
Reading on the documentation about pnpm's hoisting strategy, it says
So if I understand this correctly, pnpm prevents situations where a project can run on my machine because all its dependencies are installed in |
Beta Was this translation helpful? Give feedback.
-
@jorgeazevedo exactly - node module resolution algorithm doesn't check versions of packages or origins, just whether it can find something in a you can make your own not hoisting prevents inadvertent use of transitive dependencies and ensures each file imports the version of a dep specified in the package it belongs to (rather than whatever wins in the hoisting negotiation. when bundling for browsers this can mean shipping multiple copies of the same lib, but the alternative is shipping a single copy that is then incompatible with the code that imports it (project still need to manage this situation) |
Beta Was this translation helpful? Give feedback.
-
here's a good, very in-depth analysis of the problem https://github.com/npm/rfcs/blob/main/accepted/0042-isolated-mode.md |
Beta Was this translation helpful? Give feedback.
-
just a bit more context - used in azure devops and across MS dependabot/dependabot-core#1736 (comment) |
Beta Was this translation helpful? Give feedback.
-
Dependabot now supports vulnerability scanning with pnpm: https://github.blog/changelog/2023-08-02-pnpm-support-for-dependency-graph-dependabot-alerts-and-dependabot-security-updates/ |
Beta Was this translation helpful? Give feedback.
-
DCR is now on @guardian/devx-security are aware and on board. Let's maybe let the dust settle on it, and if all looks good in a couple of weeks, I think we can formalise a recommendation. |
Beta Was this translation helpful? Give feedback.
-
Worth noting that
Furthermore, identifying dependencies with |
Beta Was this translation helpful? Give feedback.
-
Proposal
pnpm
should be our standard package manager.Why do we need a standard?
Different package manager have different behaviours in terms of how they manage range resolution, store deps and report issues to consumers.
They also have different levels of support from third parties. Standardising on one tool minimises the amount of hoop-jumping and investigation of problematic idiosyncrasies.
Why
pnpm
?Why not?
pnpm
, and [does not plan to as of this quarter], but...(Feature request: support thepnpm
package manager dependabot/dependabot-core#1736 (comment))pnpm
and in many other ways is superior, but has only tentative support of the tech councilthere's https://github.com/snyk-tech-services/snyk-pnpm-github-action – @kenoir is this a viable option if we otherwise wanted to standardise onnopnpm
?Beta Was this translation helpful? Give feedback.
All reactions