git.iko.soy/typeable/nixpkgs
on master help sign in
yarn2nix: Handle codeload.github.com tarballs

This was submitted originally in https://github.com/nix-community/yarn2nix/pull/130

commit32c9918ba67abaf828e7060ea05a6c0f2fa403b9 authorlassulus <lassulus@lassul.us> dateWed 30 Dec 2020, 18:16 (6 years ago) parent7543a5b
1 file changed+9−1
pkgs/development/tools/yarn2nix-moretea/yarn2nix/lib/urlToName.js+9−1
pkgs/development/tools/yarn2nix-moretea/yarn2nix/lib/urlToName.js+9−1
@@ -7,9 +7,17 @@ const path = require('path')
77// - https://registry.npmjs.org/acorn-es7-plugin/-/acorn-es7-plugin-1.1.7.tgz
88// - git+https://github.com/srghma/node-shell-quote.git
99// - git+https://1234user:1234pass@git.graphile.com/git/users/1234user/postgraphile-supporter.git
10+// - https://codeload.github.com/Gargron/emoji-mart/tar.gz/934f314fd8322276765066e8a2a6be5bac61b1cf
1011
1112function urlToName(url) {
12− if (url.startsWith('git+')) {
13+
14+ // Yarn generates `codeload.github.com` tarball URLs, where the final
15+ // path component (file name) is the git hash. See #111.
16+ // See also https://github.com/yarnpkg/yarn/blob/989a7406/src/resolvers/exotics/github-resolver.js#L24-L26
17+ let isCodeloadGitTarballUrl =
18+ url.startsWith('https://codeload.github.com/') && url.includes('/tar.gz/')
19+
20+ if (url.startsWith('git+') || isCodeloadGitTarballUrl) {
1321 return path.basename(url)
1422 }
1523