1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-29 09:02:46 +00:00

Merge pull request #107979 from Lassulus/yarn2nix_codeload

This commit is contained in:
Sandro 2020-12-31 20:31:22 +01:00 committed by GitHub
commit 30ec6cf329
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
}