nix-community / yarn2nix

Generate nix expressions from a yarn.lock file [maintainer=???]
GNU General Public License v3.0
123 stars 61 forks source link

Handle codeload.github.com tarballs #130

Closed nh2 closed 4 years ago

nh2 commented 4 years ago

Fixes #111.

Fixes package.json contents

"emoji-mart": "Gargron/emoji-mart#build",

being turned into yaml.lock by yarn:

emoji-mart@Gargron/emoji-mart#build:
  version "2.6.3"
  resolved "https://codeload.github.com/Gargron/emoji-mart/tar.gz/934f314fd8322276765066e8a2a6be5bac61b1cf"

and then being turned incorrectly into this by yarn2nix:

{
  name = "https___codeload.github.com_Gargron_emoji_mart_tar.gz_934f314fd8322276765066e8a2a6be5bac61b1cf";
  path = fetchurl {
    name = "https___codeload.github.com_Gargron_emoji_mart_tar.gz_934f314fd8322276765066e8a2a6be5bac61b1cf";
    url  = "https://codeload.github.com/Gargron/emoji-mart/tar.gz/934f314fd8322276765066e8a2a6be5bac61b1cf";
    sha1 = "1768aa6ab3d6b926f457e082bd4ed7279f6fc9cf";
  };
}

With this fix, it turns it into

{
  name = "934f314fd8322276765066e8a2a6be5bac61b1cf";
  path = fetchurl {
    name = "934f314fd8322276765066e8a2a6be5bac61b1cf";
    url  = "https://codeload.github.com/Gargron/emoji-mart/tar.gz/934f314fd8322276765066e8a2a6be5bac61b1cf";
    sha1 = "1768aa6ab3d6b926f457e082bd4ed7279f6fc9cf";
  };
}

so that the file 934f314fd8322276765066e8a2a6be5bac61b1cf, which yarn checks for in the *-offline directory, actually exists there.

m-bock commented 4 years ago

I suggest to merge this one. It works and saved me lot of work. thx!