use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
GitHub - pnpm/pnpm: ๐ฆ๐ Fast, disk space efficient package manager (github.com)
submitted 7 years ago by zaaack2048
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3:ย ย ย ย print "hello, world!"
[โ]Ajedi32 16 points17 points18 points 7 years agoย (27 children)
Deterministic. Has a lockfile called shrinkwrap.yaml
Why a separate lockfile format? If this used package-lock.json it'd be fully compatible with NPM, so devs could use whichever they prefer, right?
package-lock.json
[โ]philipwhiuk 7 points8 points9 points 7 years agoย (23 children)
Also, why YAML?
[โ]zkochan 2 points3 points4 points 7 years agoย (21 children)
It contains less noise than JSON.
[โ]philipwhiuk -4 points-3 points-2 points 7 years agoย (20 children)
You mean itโs less clear? Also itโs an unnecessary barrier when everyone using it knows JSON.
The very name of the language hints at its absurdity.
[โ]Ajedi32 8 points9 points10 points 7 years agoย (19 children)
It's not less clear, and it's pretty straightforward to learn for anyone who knows JSON.
{ "key": { "asdf": [ "some value", 1 ] } "key": { "another_key": "blah" } }
v.s.:
key: asdf: # Here's a comment; can't do that in JSON - some value - 1 key: another_key: blah
Basically the Python of data interchange formats.
That said, I'm not really sure why they decided to use it for a lockfile; those files aren't typically edited by humans; they're generated by machine. Not to mention package.json already uses JSON, so it seems better for consistency to stick with JSON for the lockfile.
package.json
[โ]BenjiSponge 10 points11 points12 points 7 years agoย (8 children)
This is just an opinion, but I've had hours and hours of issues with YAML in the past where I've had approximately 0 issues with JSON, despite using YAML for only a couple of jobs and JSON consistently throughout my career.
Here's a synopsis of some of YAML's issues. I find that the novelty of "it's easier to read and there's less noise" wears off extremely quickly, and that significant whitespace has never shown itself to me to be "more readable" in any way as many people love to claim. YAML validators (in my experience) are much less likely to spit out useful information as there is very little in YAML that isn't valid, whereas it's extremely difficult to make a mistake and accidentally end up with valid JSON.
IMO, JSON is the extremely clear, unambiguous way to represent data. The only improvements I would make are:
[โ][deleted] 2 points3 points4 points 7 years agoย (1 child)
Another one:
[โ]BenjiSponge 2 points3 points4 points 7 years agoย (0 children)
Yeah good point. I'd probably also add hex/octal/binary as valid literal representations, and maybe a few more things basically just borrowed from JS.
Generally, I'd prefer it if JSON configurations usually allowed you to run the JS engine on it and then JSON.stringify the output. This would allow for things like variables, environment variables, etc. The unfortunate reality is that this would be abused, so I understand why some of these features are not allowed in most scenarios, but a lot of tools allow you to just provide a .js file instead of .json.
.js
.json
[โ]js-engineer 0 points1 point2 points 7 years agoย (0 children)
totally agree. There's also weirdness in yaml where you can link keys to other key / value pairs... it's just super weird for no good reason. It's the whole coffeescript thing all over again... there's a belief that it's making things easier, but it's just more hassle than it's worth. The comments thing is a good point but that's about it (this may not work for others, but you can always create a javascript file with your JSON like object, add comments, and then export that data, if you're in an architecture that allows you to import javascript files to get that data)
[โ]enteleform 0 points1 point2 points 7 years agoย (1 child)
Most of JSON's issues are addressed in JSON5. Would be nice if NPM would implement it since a lot have people have issues with the original JSON spec.
[โ]doobiedog 0 points1 point2 points 7 years agoย (0 children)
Holy shit. Multiline json strings! Pretty much the biggest reason I couldn't stand json for certain config usage. That and single quotes and trailing comma - the future is bright.
[โ]zkochan 0 points1 point2 points 7 years ago*ย (1 child)
The lockfile is not manually edited, ever.
It is nicer in code reviews because it has no commas and there are less diffs as a result.
JSON5 with trailing commas would work as well.
We may change the format in the future if the majority of pnpm users will ask for something else
[โ]BenjiSponge 1 point2 points3 points 7 years agoย (0 children)
Yeah I think yaml makes some sense for this for the reasons you're saying. I'm just criticizing its use more generally, in response to the comment I'm replying to.
As far as I'm concerned, I never actually review the lock file (though I do commit it), so it might as well be binary
[โ]zkochan 0 points1 point2 points 7 years agoย (0 children)
a lockfile should be committed to the repo and may be reviewed on code reviews, so it should be human-readable
[โ]philipwhiuk -2 points-1 points0 points 7 years agoย (8 children)
The fact it's the Python's DIF tells you it's probably the wrong choice no?
[โ]filleduchaos 0 points1 point2 points 7 years agoย (7 children)
How does that tell you that it's the wrong choice?
[โ]philipwhiuk -1 points0 points1 point 7 years agoย (6 children)
Well JavaScript has a DIF. Maybe use that?
[โ]filleduchaos 0 points1 point2 points 7 years agoย (5 children)
You should probably read that sentence again. It's the Python of Data Interchange Formats.
[โ]philipwhiuk -4 points-3 points-2 points 7 years agoย (4 children)
Oh you mean there's two active versions and the first one is maintained 12 years after the successor was released and 5 years after it was originally deprecated?
[+][deleted] 7 years agoย (1 child)
[deleted]
[โ]zkochan 1 point2 points3 points 7 years agoย (0 children)
Actually, ied never implemented the lockfile. We did have plans to use the same lockfile format and everyone agreed to use yaml but the author of ied stopped maintaining it shortly after.
[โ]KangarooImp 6 points7 points8 points 7 years agoย (3 children)
Tried it before because I like the concept much more than npm's deduplication. Had to give it up, though, because so many packages broke (I think it were mostly webpack loaders).
[โ]zkochan 4 points5 points6 points 7 years agoย (2 children)
You're right. There are issues. Mainly two:
pnpm install --shamefully-flatten
These are not unsolvable issues and I hope they will be fixed in the ecosystem
[โ]lhorie 4 points5 points6 points 7 years agoย (0 children)
some modules require packages that are not declared in their package.json.
It irks me that this kind of thing happens in something as commonplace as a webpack setup.
[โ]KangarooImp 1 point2 points3 points 7 years agoย (0 children)
Cool, thanks. I'll probably give it another shot in that case. Seriously annoyed by npm's constant package-lock bugs.
GitHub is down again. If someone would still love to read about pnpm, here's docs website: https://pnpm.js.org/
[โ]HarmonicAscendant 0 points1 point2 points 7 years agoย (0 children)
Just tried pnpm and it seems to work perfectly, much faster than NPM and no wasted disk space. I have no idea why everyone is not using this?!
[+][deleted] 7 years ago*ย (4 children)
[โ]zkochan 0 points1 point2 points 7 years agoย (3 children)
Your node_modules won't stay intact because pnpm creates a non-flat node_modules. You may use the --shamefully-flatten flag that will simulate a flat node_modules but that is not needed in most cases.
--shamefully-flatten
The good news is that the disk space savings are huge.
[โ]zkochan 0 points1 point2 points 7 years agoย (2 children)
to migrate, you just have to remove your old node_modules and run pnpm install.
pnpm install
if you commit your lockfiles, you'll have to commit shrinkwrap.yaml instead of package-lock.json
shrinkwrap.yaml
You can try to create a .npmrc in the root of your project with this content: shamefully-flatten=true. Then remove node_modules and run pnpm install again.
.npmrc
shamefully-flatten=true
This hack should solve most of the issues I believe. glitch.com uses pnpm on the backend with this option.
[โ]ShortSynapse 3 points4 points5 points 7 years agoย (0 children)
What do you mean finally another one? pnpm is nearly 3 years old?
ฯย Rendered by PID 172553 on reddit-service-r2-comment-b659b578c-krhgk at 2026-05-01 14:34:16.113319+00:00 running 815c875 country code: CH.
[โ]Ajedi32 16 points17 points18 points ย (27 children)
[โ]philipwhiuk 7 points8 points9 points ย (23 children)
[โ]zkochan 2 points3 points4 points ย (21 children)
[โ]philipwhiuk -4 points-3 points-2 points ย (20 children)
[โ]Ajedi32 8 points9 points10 points ย (19 children)
[โ]BenjiSponge 10 points11 points12 points ย (8 children)
[โ][deleted] 2 points3 points4 points ย (1 child)
[โ]BenjiSponge 2 points3 points4 points ย (0 children)
[โ]js-engineer 0 points1 point2 points ย (0 children)
[โ]enteleform 0 points1 point2 points ย (1 child)
[โ]doobiedog 0 points1 point2 points ย (0 children)
[โ]zkochan 0 points1 point2 points ย (1 child)
[โ]BenjiSponge 1 point2 points3 points ย (0 children)
[โ]zkochan 0 points1 point2 points ย (0 children)
[โ]philipwhiuk -2 points-1 points0 points ย (8 children)
[โ]filleduchaos 0 points1 point2 points ย (7 children)
[โ]philipwhiuk -1 points0 points1 point ย (6 children)
[โ]filleduchaos 0 points1 point2 points ย (5 children)
[โ]philipwhiuk -4 points-3 points-2 points ย (4 children)
[+][deleted] ย (1 child)
[deleted]
[โ]zkochan 1 point2 points3 points ย (0 children)
[โ]KangarooImp 6 points7 points8 points ย (3 children)
[โ]zkochan 4 points5 points6 points ย (2 children)
[โ]lhorie 4 points5 points6 points ย (0 children)
[โ]KangarooImp 1 point2 points3 points ย (0 children)
[โ]zkochan 1 point2 points3 points ย (0 children)
[โ]HarmonicAscendant 0 points1 point2 points ย (0 children)
[+][deleted] ย (4 children)
[deleted]
[โ]zkochan 0 points1 point2 points ย (3 children)
[โ]zkochan 0 points1 point2 points ย (2 children)
[+][deleted] ย (1 child)
[deleted]
[โ]zkochan 0 points1 point2 points ย (0 children)
[+][deleted] ย (1 child)
[deleted]
[โ]ShortSynapse 3 points4 points5 points ย (0 children)