mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
fetchYarnDeps: account for more yarn.lock spec edge cases
* Ignore relative `file:` paths. * Support github codeload URLs with `refs/tags/tag` in addition to just `tag`. * Support https://github.com/owner/repo/archive/ref.tar.gz URLs for git download.
This commit is contained in:
parent
4361baa782
commit
e7cd275cd8
@ -91,12 +91,21 @@ const isGitUrl = pattern => {
|
||||
}
|
||||
|
||||
const downloadPkg = (pkg, verbose) => {
|
||||
const [ name, spec ] = pkg.key.split('@', 2);
|
||||
if (spec.startsWith('file:')) {
|
||||
console.info(`ignoring relative file:path dependency "${spec}"`)
|
||||
return
|
||||
}
|
||||
|
||||
const [ url, hash ] = pkg.resolved.split('#')
|
||||
if (verbose) console.log('downloading ' + url)
|
||||
const fileName = urlToName(url)
|
||||
if (url.startsWith('https://codeload.github.com/') && url.includes('/tar.gz/')) {
|
||||
const s = url.split('/')
|
||||
downloadGit(fileName, `https://github.com/${s[3]}/${s[4]}.git`, s[6])
|
||||
return downloadGit(fileName, `https://github.com/${s[3]}/${s[4]}.git`, s[s.length-1])
|
||||
} else if (url.startsWith('https://github.com/') && url.endsWith('.tar.gz')) {
|
||||
const s = url.split('/')
|
||||
return downloadGit(fileName, `https://github.com/${s[3]}/${s[4]}.git`, s[s.length-1].replace(/.tar.gz$/, ''))
|
||||
} else if (isGitUrl(url)) {
|
||||
return downloadGit(fileName, url.replace(/^git\+/, ''), hash)
|
||||
} else if (url.startsWith('https://')) {
|
||||
|
Loading…
Reference in New Issue
Block a user