News for hackers. Stuff that matters.
Re:pnpm: Fast, disk space efficient package manager for Java... by kall on Tuesday April 05, 2022 @04:58PM (#30924937)
I'm pretty immune to most JS ecosystem churn, but on package managers I'm feeling it.

All I want is a package manager that is correct, causes very few day to day issues and is going to work the same way for many years. Yet everyone seems to be optimizing disk usage and speed without even getting the basics (make it work, make it right) fully covered.

I don't understand why people are optimizing for disk space at all tbh. Like, have you ever edited a video project, used docker, installed Xcode? I cannot imagine what you must be doing for all node_modules combined to take up more than maybe 100 GB on disk.

pnpm seems to be the lightest of the bunch, which is nice but why even mess with symlinks and confuse other tools? Just put all the files in there, nest them and duplicate them and everything. I'll happily live with my 10 GB node_modules folder that never breaks and sometimes gives me a nice coffee break.

Possibly I'm actually just salty that Metro doesn't support symlinks and would otherwise be on the pnpm love-train.

Re:pnpm: Fast, disk space efficient package manager for Java... by ramesh31 on Tuesday April 05, 2022 @05:09PM (#30925078)
NPM just has too much institutional inertia to avoid. The moment you make the decision to use something else, you are simply trading one set of warts for another. I can't even tell you how many projects I have seen waste countless hours of dev time on Yarn/NPM discrepancies. If you are working on anything with more than two people, you really need to just use the standard tooling that everyone is familiar with and that the entire ecosystem is based around. Anything else is yak shaving.
Re:pnpm: Fast, disk space efficient package manager for Java... by aabbcc1241 on Tuesday April 05, 2022 @08:49PM (#30927060)
I have custom bash scripts named npm and yarn, they invoke pnpm for installing and uninstalling packages, and fallback on other commands (e.g. audit).

This way work well with other tools (e.g. I can force create-react-app to install packages with pnpm)

Re:pnpm: Fast, disk space efficient package manager for Java... by brainbag on Tuesday April 05, 2022 @10:35PM (#30927849)
There's an npm package "narn" that uses commands akin to yarn's but will automatically use whatever package manager the current folder(/parent) is using. I almost never type npm or yarn or pnpm, just narn everywhere. Really handy.
Re:pnpm: Fast, disk space efficient package manager for Java... by aabbcc1241 on Tuesday April 12, 2022 @12:37PM (#31004962)
I added the script to PATH, so other tools that hard-coded to use yarn or npm (e.g. create-react-app) are hijacked to use pnpm when installing packages
Re:pnpm: Fast, disk space efficient package manager for Java... by Aeolun on Wednesday April 06, 2022 @12:09AM (#30928353)
I went back to composer for a bit recently (PHP), and I was baffled when my install command did nothing other than install exactly the packages I’d specified. When I ran update, it didn’t modify any of my files, but went to the latest version matching the restrictions I’d specified in composer.json.

Such a breath of fresh air…

Re:pnpm: Fast, disk space efficient package manager for Java... by zcmack on Wednesday April 06, 2022 @12:21AM (#30928442)
very much the opposite of my experience. i'd gladly have 30 copies of left-pad living in my project rent free if it meant i never had to see "Your requirements could not be resolved to an installable set of packages" ever again.
Re:pnpm: Fast, disk space efficient package manager for Java... by kaba0 on Wednesday April 06, 2022 @12:31PM (#30934207)
Until it breaks on a fresh install? Reproducibility is a must.
Re:pnpm: Fast, disk space efficient package manager for Java... by eyelidlessness on Tuesday April 05, 2022 @10:31PM (#30927833)
PNPM’s primary feature, even if it gets lost in all the optimization, is make it work, make it right. With an emphasis on the former serving the latter as the goal. FS links are an implementation detail. The thing it gets right is resolving only the dependencies you specify, unless you very clearly say otherwise. The way it does so just also happens to be efficient. If it’s confusing any other tools, they’re doing something wrong too. Links aren’t some wild new concept.
Re:pnpm: Fast, disk space efficient package manager for Java... by draaglom on Tuesday April 05, 2022 @05:11PM (#30925098)
I'm not sure if this is the _main_ reason, but one thing that makes node_modules size more than an aesthetic concern is serverless.

Booting a serverless function with 100s of mbs of modules takes an appreciable time - to the point where some folks webpack bundle their serverless code

Re:pnpm: Fast, disk space efficient package manager for Java... by 14u2c on Tuesday April 05, 2022 @07:11PM (#30926342)
Are people actually downloading dependencies on the fly like this? IMO a bundler is absolutely essential. What if npm is down? What if the version of a dependency has been deleted for some reason? These are surprises you absolutely do not want when a function is starting.
Re:pnpm: Fast, disk space efficient package manager for Java... by Aeolun on Wednesday April 06, 2022 @12:11AM (#30928368)
You don’t download the modules when your function starts. You include 500mb of dependencies in your 50kb lambda function.

The difference in boot time between 50kb and 500mb is quite significant.

Re:pnpm: Fast, disk space efficient package manager for Java... by djbusby on Tuesday April 05, 2022 @07:52PM (#30926666)
Or left-pad or that other one. JS ecosystem seems dangerous to no version pin, pack and maybe self-host the needed+known-good modules
Re:pnpm: Fast, disk space efficient package manager for Java... by pragmatic on Tuesday April 05, 2022 @09:36PM (#30927433)
Is this a thing? A buddy started at a new place and he was noticing webpack bundling for the backend.

Makes sense when you think about it I guess. Only used bundlers for front end stuff.

Re:pnpm: Fast, disk space efficient package manager for Java... by adamparsons on Wednesday April 06, 2022 @12:19AM (#30928433)
If backend services are written in TS (instead of JS) then you'll need to compile to run it. Be that TSC or webpack with ts-loader, you'll need something to perform that step. I don't think anyone is running ts-node outside of local dev environments.
Re:pnpm: Fast, disk space efficient package manager for Java... by qudat on Tuesday April 05, 2022 @11:43PM (#30928243)
If you want typescript on the BE then you at least need a build step.
Re:pnpm: Fast, disk space efficient package manager for Java... by geoffmanning on Tuesday April 05, 2022 @10:45PM (#30927915)
I'm just now finding that webpack is mostly a foreign concept in backend nodejs tech, but it's mind boggling to me that the norm was to ship code with the node_modules folder instead of bundling and minifying. Seriously, why? It's so wasteful... :'(
Re:pnpm: Fast, disk space efficient package manager for Java... by ttty on Tuesday April 05, 2022 @11:48PM (#30928263)
I just bundle everything except binary dependencies. Faster deployments
Re:pnpm: Fast, disk space efficient package manager for Java... by zkochan on Tuesday April 05, 2022 @05:13PM (#30925114)
You can use pnpm without symlinks by setting node-linker=hoisted

https://pnpm.io/npmrc#node-linker

Re:pnpm: Fast, disk space efficient package manager for Java... by kall on Tuesday April 05, 2022 @05:20PM (#30925192)
That's great news! pnpm might be my answer after all.
Re:pnpm: Fast, disk space efficient package manager for Java... by geoffmanning on Tuesday April 05, 2022 @10:35PM (#30927852)
100% agreed here. If your package manager confuses established tooling and libraries, it's garbage. I recently started working at a company that uses this, and, horrifyingly, uses a monorepo, and their serverless lambdas are all at least 70+mb. I can't even fix it by using the webpack plugin because pnpm breaks webpack. Also worth noting that 90% of the "problems" that yarn and pnpm try to address were addressed by later versions of npm. Node, being very much tied to npm, doesn't need more package managers, it needs consensus and collaboration to improve on that consensus, and without breaking libs.
Re:pnpm: Fast, disk space efficient package manager for Java... by epolanski on Tuesday April 05, 2022 @07:41PM (#30926582)
Because symlinks solve all the pronlems of nesting and duplication while providing none that I can think of.

I've been using pnpm and rush in my projecrs, and going back to npm at my employer's every day is such a chore.

Re:pnpm: Fast, disk space efficient package manager for Java... by pas on Wednesday April 06, 2022 @03:55AM (#30929593)
yarn1 used to have a global package cache (enabled by default), but now it's disabled, because many packages don't work if they are symlinked.
Re:pnpm: Fast, disk space efficient package manager for Java... by kaba0 on Wednesday April 06, 2022 @12:30PM (#30934187)
Other than the biggest OS pretty much choking on the node_modules black hole whenever you do a global operation on it (try deleting a js project on Windows)
Re:pnpm: Fast, disk space efficient package manager for Java... by rplnt on Thursday April 07, 2022 @04:27AM (#30942030)
Some years back, when npm itself didn't do deduplication of modules, it was impossible to work with some projects on windows due to OS path length limit.
Re:pnpm: Fast, disk space efficient package manager for Java... by edzillion on Wednesday April 06, 2022 @12:53PM (#30934599)
rimraf is your friend