Live data from Hacker News

Yarn's Future – v2 and beyond

github.com

61–70 of 239 posts

Re: Yarn's Future – v2 and beyond

#61
post #47

Earlier quoted context omitted.

> I think it's now clear that Facebook is admitting defeat with Flow. It sounds to me more like they're testing the waters. They're definitely opening up, with the whole Jest and create-react-app supporting it, but as far as using it themselves would this be the first project to be migrated?

Jest is migrating to typescript: https://github.com/facebook/jest/pull/7554#issuecomment-4543...

Oh, gotcha! Missed that comment.

Re: Yarn's Future – v2 and beyond

#62
post #6

Earlier quoted context omitted.

There have been several projects that were flow based that have moved to TS. I think the real litmus test will be if React eventually either includes TS types or is rewritten in TS. Disclaimer: I work with TypeScript professionally.

I'm pretty in tune with what's going on around React, and I don't see that one ever happening. The React team is _very_ busy already with work around Hooks, Concurrent Mode, and Suspense. There's no way they're going to pause development on implementing all these major chunks of functionality just to rewrite from one type system to another. I've seen Dan express some frustration with Flow's pace of development on Twi…

One of the benefits to TypeScript is that the codebase wouldn't need to be rewritten.

A declaration file(s) could be included. There they could just declare types for all classes, methods, constants, etc. Similar to C header files.

(This is how the DefinitelyTyped repository handles typings for untyped source repositories: https://github.com/DefinitelyTyped/DefinitelyTyped)

Ex:

JavaScript: app.js

    function app(arg1, arg2, arg3) {
       // does something
       return {
          key1: someStringValue,
          key2: someNumberValue,
       };
    }
TypeScript: app.d.ts

    declare type AppReturnValue = { key1: string, key2: number };
    declare function app(arg1: string, arg2: string[], arg3: boolean): AppReturnValue;

Re: Yarn's Future – v2 and beyond

#64
> The codebase will be ported from Flow to TypeScript. To understand the rational please continue reading, but a quick summary is that we hope this will help our community ramp up on Yarn, and will help you build awesome new features on top of it.

Another major project moving from flow to typescript

Re: Yarn's Future – v2 and beyond

#66
post #7

I’m glad that Yarn will continue. Npm has improved, but it’s still less pleasant to work with than yarn (which basically always does what I expect, not so for npm).

npm has eroded so much of my trust that I am hesitant to switch back to it any time soon. I've tried npm out every few months (since npm 3), and have consistently run into infuriating bugs or unexpected behaviors.

Much of it has been fixed over time, but the frequency and duration of these issues is concerning—and, I think, points to architectural deficiencies being the root of the problem. (And the project is so massive that it's understandably a really challenging thing to manage and triage)

For example:

* npm 5.0.0—5.7.0 didn't play nice with git-based dependencies (https://github.com/npm/npm/issues/17379)

* npm 5.0.0—5.4.1 edits package-lock.json unexpectedly (https://github.com/npm/npm/issues/17979)

* npm 5.0.0—5.4.? doesn't honor incompatible version differences in package.json compared to package-lock.json (https://github.com/npm/npm/issues/16866)

* Take a look at the issues labeled as [big-bug], and how long they've languished (mostly from the v3 era): https://github.com/npm/npm/issues?q=is%3Aissue+is%3Aopen+sor....

* and a bunch of others I can't remember off the top of my head; especially nondeterministic behavior in the v2 and v3 era.

Re: Yarn's Future – v2 and beyond

#67

Very happy to see yarn.lock will finally be a proper format that won't need its own parser. YAML subset is a pretty good choice, though I think canonicalized, indented JSON would be a better choice for this use case. Incidentally that's what npm uses as lockfile, I wonder if there's room to have the two package managers share the format (or even share the file itself). Very excited to see shell compatibility guarante…

npm's lockfile is a pain to diff in PRs because of the JSON format where what was maybe 20 changed lines in yarn is upwards of 80 from the brackets.

With YAML and whatever format yarn.lock was in, the only changed lines are changes to the version resolutions, hash and dependencies.

Re: Yarn's Future – v2 and beyond

#68
post #47

Earlier quoted context omitted.

> I think it's now clear that Facebook is admitting defeat with Flow. It sounds to me more like they're testing the waters. They're definitely opening up, with the whole Jest and create-react-app supporting it, but as far as using it themselves would this be the first project to be migrated?

Jest is getting migrated to Typescript as well, not just adding support for it. And then there's... whatever this is: https://twitter.com/jamiebuilds/status/1064649666275340288?l...

He’s right. I’ve been using Flow for 2 or 3 years, the tool does the job but it has many bugs and NO support AT ALL. Same for the communication, no roadmap, no yearly post about what’s going on, nothing. I started moving our projects to TS too.

Re: Yarn's Future – v2 and beyond

#69
post #52

The JS ecosystem has its flaws, but one has to appreciate the speed at which momentum shifts, making clear winners obvious. The move towards TypeScript 'winning' has been fast, and to everyone's benefit.

Maybe it's a benefit when moving from Flow, but personally, I would rather have JS projects spend that time adding more tests than converting to static typing.

Edit: changed strong to static.

Re: Yarn's Future – v2 and beyond

#70

I'm curious as to why yarn instead of contributing to NPM? I am aware that yarn was the inspiration for many improvements for NPM by providing an alternative, but going forward do we need two systems? Is the plan for yarn to be compatible with NPM and package.json?

Yes, having competition here has clearly benefited the ecosystem.

I wrote a recent comment comparing the history and goals of Yarn and NPM:

https://news.ycombinator.com/item?id=18950012

Post reply on HN