diff --git a/pkgs/development/tools/yarn2nix-moretea/yarn2nix/bin/yarn2nix.js b/pkgs/development/tools/yarn2nix-moretea/yarn2nix/bin/yarn2nix.js index d4f160b124d7..d6b4dcf358c3 100755 --- a/pkgs/development/tools/yarn2nix-moretea/yarn2nix/bin/yarn2nix.js +++ b/pkgs/development/tools/yarn2nix-moretea/yarn2nix/bin/yarn2nix.js @@ -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) diff --git a/pkgs/development/tools/yarn2nix-moretea/yarn2nix/lib/generateNix.js b/pkgs/development/tools/yarn2nix-moretea/yarn2nix/lib/generateNix.js index 407a602dc5a7..7df4679a1308 100644 --- a/pkgs/development/tools/yarn2nix-moretea/yarn2nix/lib/generateNix.js +++ b/pkgs/development/tools/yarn2nix-moretea/yarn2nix/lib/generateNix.js @@ -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