Patch npm packages to ignore npm requirements

Some npm packages strictly require a specific npm version because npm
don't handle some version requirements the same way in 1.0 and 2.0.

However, Nix don't use npm for dependency resolution (this is always
achieved with npm 1.0 criteria by npm2nix), so these requirements turns
out to be pointless and just crashes some package installations.

This patch removes npm requirements so the packages can still be built.

This solves #5787.
This commit is contained in:
Valérian Galliat 2015-02-07 15:04:35 +01:00
parent 9792b12e53
commit 25ce27b45e

View File

@ -83,6 +83,9 @@ let
# Some version specifiers (latest, unstable, URLs, file paths) force NPM # Some version specifiers (latest, unstable, URLs, file paths) force NPM
# to make remote connections or consult paths outside the Nix store. # to make remote connections or consult paths outside the Nix store.
# The following JavaScript replaces these by * to prevent that: # The following JavaScript replaces these by * to prevent that:
# Also some packages require a specific npm version because npm may
# resovle dependencies differently, but npm is not used by Nix for dependency
# reslution, so these requirements are dropped.
( (
cat <<EOF cat <<EOF
@ -131,6 +134,11 @@ let
} }
} }
/* Ignore npm version requirement */
if(packageObj.engines) {
delete packageObj.engines.npm;
}
/* Write the fixed JSON file */ /* Write the fixed JSON file */
fs.writeFileSync("package.json", JSON.stringify(packageObj)); fs.writeFileSync("package.json", JSON.stringify(packageObj));
EOF EOF