diff options
author | lassulus <lassulus@lassul.us> | 2020-12-30 18:16:34 +0100 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2020-12-30 19:01:48 +0100 |
commit | 32c9918ba67abaf828e7060ea05a6c0f2fa403b9 (patch) | |
tree | a7151e003673288a7b277d579bc5a91b89f8c60a /pkgs | |
parent | 7543a5bf7129098a7c41aeee3d58b17c4ab5ba98 (diff) |
yarn2nix: Handle codeload.github.com tarballs
This was submitted originally in https://github.com/nix-community/yarn2nix/pull/130
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/development/tools/yarn2nix-moretea/yarn2nix/lib/urlToName.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pkgs/development/tools/yarn2nix-moretea/yarn2nix/lib/urlToName.js b/pkgs/development/tools/yarn2nix-moretea/yarn2nix/lib/urlToName.js index 81feaaf3a6595..bd48b84f22d3b 100644 --- a/pkgs/development/tools/yarn2nix-moretea/yarn2nix/lib/urlToName.js +++ b/pkgs/development/tools/yarn2nix-moretea/yarn2nix/lib/urlToName.js @@ -7,9 +7,17 @@ const path = require('path') // - https://registry.npmjs.org/acorn-es7-plugin/-/acorn-es7-plugin-1.1.7.tgz // - git+https://github.com/srghma/node-shell-quote.git // - git+https://1234user:1234pass@git.graphile.com/git/users/1234user/postgraphile-supporter.git +// - https://codeload.github.com/Gargron/emoji-mart/tar.gz/934f314fd8322276765066e8a2a6be5bac61b1cf function urlToName(url) { - if (url.startsWith('git+')) { + + // Yarn generates `codeload.github.com` tarball URLs, where the final + // path component (file name) is the git hash. See #111. + // See also https://github.com/yarnpkg/yarn/blob/989a7406/src/resolvers/exotics/github-resolver.js#L24-L26 + let isCodeloadGitTarballUrl = + url.startsWith('https://codeload.github.com/') && url.includes('/tar.gz/') + + if (url.startsWith('git+') || isCodeloadGitTarballUrl) { return path.basename(url) } |