mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-23 17:56:53 +03:00
yarn2nix: handle codeload.github.com uris in IFD mode (#136922)
This commit is contained in:
parent
839fb3f523
commit
b27d18a412
2 changed files with 15 additions and 5 deletions
|
@ -53,7 +53,7 @@ if (json.type !== 'success') {
|
||||||
|
|
||||||
// Check for missing hashes in the yarn.lock and patch if necessary
|
// Check for missing hashes in the yarn.lock and patch if necessary
|
||||||
|
|
||||||
const pkgs = R.pipe(
|
let pkgs = R.pipe(
|
||||||
mapObjIndexedReturnArray((value, key) => ({
|
mapObjIndexedReturnArray((value, key) => ({
|
||||||
...value,
|
...value,
|
||||||
nameWithVersion: key,
|
nameWithVersion: key,
|
||||||
|
@ -61,10 +61,10 @@ const pkgs = R.pipe(
|
||||||
R.uniqBy(R.prop('resolved')),
|
R.uniqBy(R.prop('resolved')),
|
||||||
)(json.object)
|
)(json.object)
|
||||||
|
|
||||||
const fixedPkgsPromises = R.map(fixPkgAddMissingSha1, pkgs)
|
|
||||||
|
|
||||||
;(async () => {
|
;(async () => {
|
||||||
const fixedPkgs = await Promise.all(fixedPkgsPromises)
|
if (!options['--no-patch']) {
|
||||||
|
pkgs = await R.map(fixPkgAddMissingSha1, pkgs)
|
||||||
|
}
|
||||||
|
|
||||||
const origJson = lockfile.parse(data)
|
const origJson = lockfile.parse(data)
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ const fixedPkgsPromises = R.map(fixPkgAddMissingSha1, pkgs)
|
||||||
|
|
||||||
if (!options['--no-nix']) {
|
if (!options['--no-nix']) {
|
||||||
// print to stdout
|
// print to stdout
|
||||||
console.log(generateNix(fixedPkgs, options['--builtin-fetchgit']))
|
console.log(generateNix(pkgs, options['--builtin-fetchgit']))
|
||||||
}
|
}
|
||||||
})().catch(error => {
|
})().catch(error => {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
|
|
@ -80,6 +80,16 @@ function fetchLockedDep(builtinFetchGit) {
|
||||||
|
|
||||||
const fileName = urlToName(url)
|
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:")) {
|
if (url.startsWith('git+') || url.startsWith("git:")) {
|
||||||
const rev = sha1OrRev
|
const rev = sha1OrRev
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue