summary refs log tree commit diff
path: root/pkgs/development/tools/yarn2nix-moretea/yarn2nix/internal
diff options
context:
space:
mode:
authorAmineChikhaoui <amine@chikhaoui.org>2021-04-15 05:02:41 -0400
committerJan Tojnar <jtojnar@gmail.com>2021-12-04 08:02:10 +0100
commit487aaa905f78e7f3acaef238650552d74730851b (patch)
tree1a5ec9061a012b17d34357b5778816a4b0696d28 /pkgs/development/tools/yarn2nix-moretea/yarn2nix/internal
parentdad4fddd52923d90c5ad981d5e29963e829de3c1 (diff)
downloadnixpkgs-487aaa905f78e7f3acaef238650552d74730851b.tar
nixpkgs-487aaa905f78e7f3acaef238650552d74730851b.tar.gz
nixpkgs-487aaa905f78e7f3acaef238650552d74730851b.tar.bz2
nixpkgs-487aaa905f78e7f3acaef238650552d74730851b.tar.lz
nixpkgs-487aaa905f78e7f3acaef238650552d74730851b.tar.xz
nixpkgs-487aaa905f78e7f3acaef238650552d74730851b.tar.zst
nixpkgs-487aaa905f78e7f3acaef238650552d74730851b.zip
yarn2nix: use yarn lockfile integrity field whenever possible
Whenever available use the SRI hashes from the integrity field to create
the fetchurl calls instead of entirely relying on the `resolved` sha1
which may or may not exist with recent yarn versions.

Related issues:

- https://github.com/nix-community/yarn2nix/issues/125
- https://github.com/NixOS/nixpkgs/issues/77238
Diffstat (limited to 'pkgs/development/tools/yarn2nix-moretea/yarn2nix/internal')
-rwxr-xr-xpkgs/development/tools/yarn2nix-moretea/yarn2nix/internal/fixup_yarn_lock.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/pkgs/development/tools/yarn2nix-moretea/yarn2nix/internal/fixup_yarn_lock.js b/pkgs/development/tools/yarn2nix-moretea/yarn2nix/internal/fixup_yarn_lock.js
index 86e92f85208..3c067fc99aa 100755
--- a/pkgs/development/tools/yarn2nix-moretea/yarn2nix/internal/fixup_yarn_lock.js
+++ b/pkgs/development/tools/yarn2nix-moretea/yarn2nix/internal/fixup_yarn_lock.js
@@ -25,14 +25,14 @@ const result = []
 
 readFile
   .on('line', line => {
-    const arr = line.match(/^ {2}resolved "([^#]+)#([^"]+)"$/)
+    const arr = line.match(/^ {2}resolved "([^#]+)(#[^"]+)?"$/)
 
     if (arr !== null) {
       const [_, url, shaOrRev] = arr
 
       const fileName = urlToName(url)
 
-      result.push(`  resolved "${fileName}#${shaOrRev}"`)
+      result.push(`  resolved "${fileName}${shaOrRev ?? ''}"`)
     } else {
       result.push(line)
     }