News for hackers. Stuff that matters.
Re:Yarn – A new package manager for JavaScript by wycats on Tuesday October 11, 2016 @11:21AM (#12685194)
I wrote a post explaining why I'm psyched to be working on it:

TLDR:

- open, community governance that will support long-term evolution

- the technical details get a lot right out of the gate (decent performance, predictability, and security)

Re:Yarn – A new package manager for JavaScript by sophiebits on Tuesday October 11, 2016 @11:37AM (#12685364)
Re:Yarn – A new package manager for JavaScript by wycats on Tuesday October 11, 2016 @11:42AM (#12685410)
Yikes, thanks!
Re:Yarn – A new package manager for JavaScript by raesene6 on Tuesday October 11, 2016 @11:50AM (#12685514)
Interested to see the emphasis on security, it's definitely something that could use more focus in this area. On that note, are there any plans to implement TUF (https://theupdateframework.github.io/) or similar into Yarn?
Re:Yarn – A new package manager for JavaScript by zamalek on Tuesday October 11, 2016 @11:30AM (#12685287)
Have you guys approached the ridiculous folder nesting situation? E.g. breaking out of the current/broken node_modules structure?
Re:Yarn – A new package manager for JavaScript by petetnt on Tuesday October 11, 2016 @11:37AM (#12685366)
There has been no problems with folder nesting in `npm` in general since the version@3 came out over a year ago.
Re:Yarn – A new package manager for JavaScript by spankalee on Tuesday October 11, 2016 @11:51AM (#12685516)
This isn't true though.

npm chooses the first version of a package it encounters to install at the top level. Every other version is installed nested. If you have N uses of version A and one use of version B, but version B is installed first, then you get N copies of the package at version A.

Re:Yarn – A new package manager for JavaScript by ksherlock on Tuesday October 11, 2016 @11:52AM (#12685527)
It's improved but it's not fixed. if a depends on c 1.0 and b depend on c 2.0, both versions of c need to be installed and one of them will be nested.
Re:Yarn – A new package manager for JavaScript by l1ambda on Tuesday October 11, 2016 @05:47PM (#12688791)
...which is actually good. With Java and maven, you cannot use multiple versions of a library.
Re:Yarn – A new package manager for JavaScript by Kenan on Tuesday October 11, 2016 @02:16PM (#12687035)
What's the solution for that case though (one which requires no nesting)? I don't think a solution with no nesting exists given the current module resolution algorithm of Node.js, which allows for only a single version of a particular package to exist at a given level.
Re:Yarn – A new package manager for JavaScript by ksherlock on Tuesday October 11, 2016 @02:44PM (#12687351)
nesting can't be prevented in that case (at least with the current node require() design). It gets really bad if you have 10 packages that depend on [email protected] and 10 packages that depend on [email protected] -- one of them will install in the root directory and the other 10 will be duplicated. ied stores a single copy of each package@version and uses symlinks which is an improvement. Apparently yarn tried something similar but it breaks some packages (that check where they're located for example).

https://github.com/alexanderGugel/ied

Re:Yarn – A new package manager for JavaScript by Osiris on Tuesday October 11, 2016 @04:25PM (#12688218)
I could be prevented. Another project does this by using a hash of the project to all all dependencies at one level then symlinks the dependencies from hash to name so it references the correct version.
Re:Yarn – A new package manager for JavaScript by zamalek on Tuesday October 11, 2016 @03:21PM (#12687667)
> no problems

Absolute and utter hogwash.

I don't even need to get into versioning to make this argument but I'll exclude it for clarity's sake. Simple scenario:

    root -> A
    root -> B
    root -> C
    A -> B
    B -> C
What folder structure is created?

    root/node_modules/A/node_modules/B/node_modules/C
    root/node_modules/B/node_modules/C
    root/node_modules/C
Symlink that all you want, how is it in any way whatsoever thoughtful and elegant? It's not a real solution by any stretch of the imagination. Myriads of pre-existing systems that correctly deal with this scenario existed at the time that NPM was concoted. Ignored. Considering that node is touted as a cross-platform solution, how well does version@3 deal with filesystems that don't support symlinks? I've run into this: not at all.

NPM version@3 could not be further from the ethos of "engineering." It's an outright hack, and it quickly betrays its limitations. It could have been far simpler, far more considerate of pre-existing wisdom.

Re:Yarn – A new package manager for JavaScript by secoif on Tuesday October 11, 2016 @06:06PM (#12688908)
what you described is npm@2's behaviour. npm@3 will flatten dependencies as much as possible
Re:Yarn – A new package manager for JavaScript by zamalek on Tuesday October 11, 2016 @06:19PM (#12689001)
How does it flatten dependencies? Symlinks?
Re:Yarn – A new package manager for JavaScript by secoif on Tuesday October 11, 2016 @06:39PM (#12689106)
no, it just installs everything it can into the top level node_modules. npm@2 would do this to a degree as well, it was just less sophisticated about it.
Re:Yarn – A new package manager for JavaScript by zamalek on Wednesday October 12, 2016 @03:28AM (#12690977)
> into the top level node_modules.

Just tried using npm3 explicitly and I stand corrected.

Re:Yarn – A new package manager for JavaScript by steveklabnik on Tuesday October 11, 2016 @11:41AM (#12685396)
(other than its non-determinism)
Re:Yarn – A new package manager for JavaScript by thejameskyle on Tuesday October 11, 2016 @11:52AM (#12685530)
And Yarn it deterministic! :party_parrot:
Re:Yarn – A new package manager for JavaScript by mvdanj on Tuesday October 11, 2016 @12:56PM (#12686161)
fwiw npm really needs an `exec` command like bundler has (ie `npm exec bin-cmd`).

"$(npm bin)/bin-cmd" is getting really old

Re:Yarn – A new package manager for JavaScript by josephfrazier on Tuesday October 11, 2016 @02:09PM (#12686947)
You can use `npm run env bin-cmd` for that. It's not as convenient as `npm exec bin-cmd` would be, but it might be easier to type than `$(npm bin)/bin-cmd`.
Re:Yarn – A new package manager for JavaScript by woah on Tuesday October 11, 2016 @02:04PM (#12686905)
What is the problem with nested folders?
Re:Yarn – A new package manager for JavaScript by gjolund on Tuesday October 11, 2016 @11:10PM (#12690194)
When do you expect ember to transition to yarn?

Are there any branches of ember-cli implementing yarn?

Re:Yarn – A new package manager for JavaScript by mvdanj on Tuesday October 11, 2016 @12:50PM (#12686117)
You say "decent performance" and "predictability". What is the basis of this claim? I've heard these all before, but unless you've actually shipped a product using this tool I don't know how you can back this up.
Re:Yarn – A new package manager for JavaScript by jameside on Tuesday October 11, 2016 @01:20PM (#12686400)
As for performance, Yarn is about 3-5x faster installing all of the dependencies and devDependencies of react-native. The benchmarks are here: https://yarnpkg.com/en/compare. It's much faster in most scenarios, especially the ones that used to take minutes.
Re:Yarn – A new package manager for JavaScript by PudgePacket on Thursday October 13, 2016 @08:39AM (#12700300)
Only if those dependencies are in the cache, otherwise it takes the same time.
Re:Yarn – A new package manager for JavaScript by jameside on Friday October 14, 2016 @04:14AM (#12706734)
The benchmarks test both the hot cache and cold cache scenarios for npm and Yarn. Except in the scenario when node_modules is already populated and there is no yarn.lock file, which is uncommon if you're using Yarn, Yarn is faster than npm in all of the benchmarked scenarios where there is a cold cache.
Re:Yarn – A new package manager for JavaScript by steveklabnik on Tuesday October 11, 2016 @01:04PM (#12686255)

  > unless you've actually shipped a product using this tool 
Given that wycats _worked on_ this tool, I would assume it's his experience helping build it that's the basis of the claim.

(I don't work at Tilde so I can't tell you if it's been shipping with yarn, but it would shock me if it wasn't.)

Re:Yarn – A new package manager for JavaScript by wycats on Tuesday October 11, 2016 @02:19PM (#12687060)
We're not using Yarn at Tilde yet, but I've been using it on Yarn itself and when working on Ember packages, and it's worked well. As far as performance, we have good benchmarks tracking yarn's performance in a whole bunch of different scenarios (https://yarnpkg.com/en/compare)
Re:Yarn – A new package manager for JavaScript by mvdanj on Tuesday October 11, 2016 @06:03PM (#12688891)
Ok, didn't realize he worked on it. Bundler is great so that gives me some hope for Yarn. But in general I think its more stable in the long-term for projects to use open standards instead of vendor solutions for browser package management.
Re:Yarn – A new package manager for JavaScript by steveklabnik on Tuesday October 11, 2016 @06:35PM (#12689081)
I can understand this sentiment in general, but don't think it applies here. npm is also a private company, and this does work with their registry. There currently isn't a vendor-neutral standard to follow.