mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-03 13:30:36 +00:00
Merge pull request #202912 from NixOS/backport-201731-to-release-22.11
[Backport release-22.11] fetchNpmDeps: allow package-json.lock symlinks
This commit is contained in:
@@ -4,7 +4,9 @@
|
||||
, src ? null
|
||||
, srcs ? null
|
||||
, sourceRoot ? null
|
||||
, prePatch ? ""
|
||||
, patches ? [ ]
|
||||
, postPatch ? ""
|
||||
, nativeBuildInputs ? [ ]
|
||||
, buildInputs ? [ ]
|
||||
# The output hash of the dependencies for this project.
|
||||
@@ -30,7 +32,7 @@
|
||||
|
||||
let
|
||||
npmDeps = fetchNpmDeps {
|
||||
inherit src srcs sourceRoot patches;
|
||||
inherit src srcs sourceRoot prePatch patches postPatch;
|
||||
name = "${name}-npm-deps";
|
||||
hash = npmDepsHash;
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ npmInstallHook() {
|
||||
local -r nodeModulesPath="$packageOut/node_modules"
|
||||
|
||||
if [ ! -d "$nodeModulesPath" ]; then
|
||||
npm prune --omit dev $npmInstallFlags "${npmInstallFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}"
|
||||
npm prune --omit dev --no-save $npmInstallFlags "${npmInstallFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}"
|
||||
find node_modules -maxdepth 1 -type d -empty -delete
|
||||
|
||||
cp -r node_modules "$nodeModulesPath"
|
||||
|
||||
@@ -140,14 +140,14 @@
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
if [[ ! -f package-lock.json ]]; then
|
||||
if [[ ! -e package-lock.json ]]; then
|
||||
echo
|
||||
echo "ERROR: The package-lock.json file does not exist!"
|
||||
echo
|
||||
echo "package-lock.json is required to make sure that npmDepsHash doesn't change"
|
||||
echo "when packages are updated on npm."
|
||||
echo
|
||||
echo "Hint: You can use the patches attribute to add a package-lock.json manually to the build."
|
||||
echo "Hint: You can copy a vendored package-lock.json file via postPatch."
|
||||
echo
|
||||
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user