nix-community / napalm

Support for building npm packages in Nix and lightweight npm registry [maintainer=?]
MIT License
104 stars 17 forks source link

Support for `yarn.lock` #25

Open terlar opened 3 years ago

terlar commented 3 years ago

I have worked on some projects where yarn.lock is used and teams seem to be quite attached to yarn so it seems unlikely that they would switch away from it completely. Does it make sense to support yarn.lock as well for source of dependencies?

nmattia commented 3 years ago

I remember reading up on both npm and yarn when I was developing napalm. I seem to recall that all the innovations that yarn brought had been integrated into npm over time, so I decided to simply support npm-style builds. Also, the yarn.lock format can't be parsed natively (with builtins.X) by Nix, which means pre-downloading the dependencies can get quite tricky! Does this help?

terlar commented 3 years ago

I see, because it is a YAML file right? I guess it could be possible to write a parser for the yarn.lock file in Nix, but might be some work. It makes sense, but still seems yarn is most popular among the people developing nodejs/typescript.

I guess the dirty way would be to do something like this: https://github.com/serokell/nix-npm-buildpackage/blob/master/default.nix#L222-L230

But I guess that is in the murky Nix practices.

nmattia commented 3 years ago

I see, because it is a YAML file right?

I was under the impression that it was a custom format but maybe this changed? I encounter yarn in the wild rarely these days (though I don't work much with javascript), I assumed it was slowly dying...