summary refs log tree commit diff
diff options
context:
space:
mode:
authorWinter <winter@winter.cafe>2022-12-08 17:29:33 -0500
committerWinter <winter@winter.cafe>2022-12-13 19:40:27 -0500
commit6a5211f123c14f95cbbb6d17c21d9e78cb178952 (patch)
tree855dd52e191f52d5cdae1c228ef6dd50968515c2
parent4db4181d9372109d73f59a08a99e7f5facf5491b (diff)
downloadnixpkgs-6a5211f123c14f95cbbb6d17c21d9e78cb178952.tar
nixpkgs-6a5211f123c14f95cbbb6d17c21d9e78cb178952.tar.gz
nixpkgs-6a5211f123c14f95cbbb6d17c21d9e78cb178952.tar.bz2
nixpkgs-6a5211f123c14f95cbbb6d17c21d9e78cb178952.tar.lz
nixpkgs-6a5211f123c14f95cbbb6d17c21d9e78cb178952.tar.xz
nixpkgs-6a5211f123c14f95cbbb6d17c21d9e78cb178952.tar.zst
nixpkgs-6a5211f123c14f95cbbb6d17c21d9e78cb178952.zip
nodejs-{16,18,19}_x: backport `npm pack` fixes from npm v9
-rw-r--r--pkgs/development/web/nodejs/npm-patches.nix23
-rw-r--r--pkgs/development/web/nodejs/v16.nix4
-rw-r--r--pkgs/development/web/nodejs/v18.nix4
-rw-r--r--pkgs/development/web/nodejs/v19.nix4
4 files changed, 32 insertions, 3 deletions
diff --git a/pkgs/development/web/nodejs/npm-patches.nix b/pkgs/development/web/nodejs/npm-patches.nix
new file mode 100644
index 00000000000..28432f806dc
--- /dev/null
+++ b/pkgs/development/web/nodejs/npm-patches.nix
@@ -0,0 +1,23 @@
+{ fetchpatch }:
+
+[
+  # Makes `npm pack` obey `--foreground-scripts`
+  (fetchpatch {
+    name = "libnpmpack-obey-foreground-scripts.patch";
+    url = "https://github.com/npm/cli/commit/e4e8ae20aef9e27e57282e87e8757d5b364abb39.patch";
+    hash = "sha256-NQ8CZBfRqAOMe0Ysg3cq1FiferWKTzXC1QXgzX+f8OU=";
+    stripLen = 2;
+    extraPrefix = "deps/npm/node_modules/";
+    includes = [ "deps/npm/node_modules/libnpmpack/lib/index.js" ];
+  })
+
+  # Makes `npm pack` obey `--ignore-scripts`
+  (fetchpatch {
+    name = "libnpmpack-obey-ignore-scripts.patch";
+    url = "https://github.com/npm/cli/commit/a990c3c9a0e67f0a8b6454213675e159fe49432d.patch";
+    hash = "sha256-eA5YST9RxMMjk5FCwEbl1HQUpXZuwWZkx5WC4yJium8=";
+    stripLen = 2;
+    extraPrefix = "deps/npm/node_modules/";
+    includes = [ "deps/npm/node_modules/libnpmpack/lib/index.js" ];
+  })
+]
diff --git a/pkgs/development/web/nodejs/v16.nix b/pkgs/development/web/nodejs/v16.nix
index a35c347c3d1..8483e7251b4 100644
--- a/pkgs/development/web/nodejs/v16.nix
+++ b/pkgs/development/web/nodejs/v16.nix
@@ -5,6 +5,8 @@ let
     inherit openssl;
     python = python3;
   };
+
+  npmPatches = callPackage ./npm-patches.nix { };
 in
   buildNodejs {
     inherit enableNpm;
@@ -13,5 +15,5 @@ in
     patches = [
       ./disable-darwin-v8-system-instrumentation.patch
       ./bypass-darwin-xcrun-node16.patch
-    ];
+    ] ++ npmPatches;
   }
diff --git a/pkgs/development/web/nodejs/v18.nix b/pkgs/development/web/nodejs/v18.nix
index 29f133a8110..b91f2c9f2c2 100644
--- a/pkgs/development/web/nodejs/v18.nix
+++ b/pkgs/development/web/nodejs/v18.nix
@@ -5,6 +5,8 @@ let
     inherit openssl;
     python = python3;
   };
+
+  npmPatches = callPackage ./npm-patches.nix { };
 in
 buildNodejs {
   inherit enableNpm;
@@ -21,5 +23,5 @@ buildNodejs {
 
     ./disable-darwin-v8-system-instrumentation.patch
     ./bypass-darwin-xcrun-node16.patch
-  ];
+  ] ++ npmPatches;
 }
diff --git a/pkgs/development/web/nodejs/v19.nix b/pkgs/development/web/nodejs/v19.nix
index cbed3bbef9a..335477aa7dd 100644
--- a/pkgs/development/web/nodejs/v19.nix
+++ b/pkgs/development/web/nodejs/v19.nix
@@ -5,6 +5,8 @@ let
     inherit openssl;
     python = python3;
   };
+
+  npmPatches = callPackage ./npm-patches.nix { };
 in
 buildNodejs {
   inherit enableNpm;
@@ -14,5 +16,5 @@ buildNodejs {
     ./revert-arm64-pointer-auth.patch
     ./disable-darwin-v8-system-instrumentation-node19.patch
     ./bypass-darwin-xcrun-node16.patch
-  ];
+  ] ++ npmPatches;
 }