DEV Community

loading...

Discussion on: Flat node_modules is not the only way

Collapse
zenmumbler profile image
zenmumbler • Edited

Hey Zoltan, I had not heard of pnpm before but installed it now because I really like the underlying (engineering) principles you mention here. I see it also support workspaces, so I will try and see if I can apply it in my Stardazed project which is a quickly-growing monorepo. It mostly uses peerDependencies, though.

I'll also look into what Jan mentioned about the recursive commands and see what they are.

My main initial feedback is that the name pnpm can be confusing to some as it implies some relation between the product and the npm org. It's probably too late to change this now but I can see why FB went with the name "yarn" as it is clearly something else.

Besides that though, looks good! Thanks!

Updated to add:

I already had the first benefit of using this as I have devDeps that work in node (rollup) and it installs the @types/node package which was causing VS Code to add a ton of Node types in the autocomplete for my browser-based package I'm writing. Now that those packages are whiffed away, I don't have to work around this anymore! Nice.

2nd update:

Ahh, pnpm recursive run ... could indeed make build processes a lot less script-heavy. Great stuff!

Collapse
zkochan profile image
Zoltan Kochan Author

Hey Arthur! Let us know if you have any issues with pnpm or questions.

pnpm (performant npm) was a name given by the initial author of pnpm - Rico Sta. Cruz. It was based on ideas of ied - another js package manager with a bad name😄.

We are aware of the bad name issue and maybe we'll rename it in the future. At the right time.

Collapse
zenmumbler profile image
zenmumbler

Thanks Zoltan, I figured out quickly indeed that the recursive commands make working with monorepos a lot easier. Very nice. I was looking through your docs and was wondering what the purpose is of pnpm server. Is it for CI contexts?

Thread Thread
zkochan profile image
Zoltan Kochan Author

The server feature was added for glitch. Their use case is that they have many containers that use a shared store but the containers don't have access to the store. So when an installation is done in a container, actions like "download a tarball from the registry" or "link a package from the store to my project" are delegated to the store server.

It probably deserves a separate article.

I see big potential in the store server. Like in the future it could keep the store warm or seed the packages in a p2p network.

Thread Thread
zenmumbler profile image
zenmumbler

Got it, thanks for explaining again. I'll convert some projects and file any issues I may find.