mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 15:33:13 +00:00
yarn2nix: handle codeload.github.com uris in IFD mode (#136922)
This commit is contained in:
parent
839fb3f523
commit
b27d18a412
@ -53,7 +53,7 @@ if (json.type !== 'success') {
|
||||
|
||||
// Check for missing hashes in the yarn.lock and patch if necessary
|
||||
|
||||
const pkgs = R.pipe(
|
||||
let pkgs = R.pipe(
|
||||
mapObjIndexedReturnArray((value, key) => ({
|
||||
...value,
|
||||
nameWithVersion: key,
|
||||
@ -61,10 +61,10 @@ const pkgs = R.pipe(
|
||||
R.uniqBy(R.prop('resolved')),
|
||||
)(json.object)
|
||||
|
||||
const fixedPkgsPromises = R.map(fixPkgAddMissingSha1, pkgs)
|
||||
|
||||
;(async () => {
|
||||
const fixedPkgs = await Promise.all(fixedPkgsPromises)
|
||||
if (!options['--no-patch']) {
|
||||
pkgs = await R.map(fixPkgAddMissingSha1, pkgs)
|
||||
}
|
||||
|
||||
const origJson = lockfile.parse(data)
|
||||
|
||||
@ -81,7 +81,7 @@ const fixedPkgsPromises = R.map(fixPkgAddMissingSha1, pkgs)
|
||||
|
||||
if (!options['--no-nix']) {
|
||||
// print to stdout
|
||||
console.log(generateNix(fixedPkgs, options['--builtin-fetchgit']))
|
||||
console.log(generateNix(pkgs, options['--builtin-fetchgit']))
|
||||
}
|
||||
})().catch(error => {
|
||||
console.error(error)
|
||||
|
@ -80,6 +80,16 @@ function fetchLockedDep(builtinFetchGit) {
|
||||
|
||||
const fileName = urlToName(url)
|
||||
|
||||
if (resolved.startsWith('https://codeload.github.com/')) {
|
||||
const s = resolved.split('/')
|
||||
const githubUrl = `https://github.com/${s[3]}/${s[4]}.git`
|
||||
const githubRev = s[6]
|
||||
|
||||
const [_, branch] = nameWithVersion.split('#')
|
||||
|
||||
return fetchgit(fileName, githubUrl, rev, branch || 'master', builtinFetchGit)
|
||||
}
|
||||
|
||||
if (url.startsWith('git+') || url.startsWith("git:")) {
|
||||
const rev = sha1OrRev
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user