logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git
commit: 03fdd3fcce6e7c4c41d2150dfa778a6553c13d54
parent 7d4202b803f543fdaba4651a176ffd270ee441bd
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri, 29 Sep 2023 19:07:10 +0200

nodejs.eclass: Handle preinstall+postinstall and prepare scripts

Diffstat:

Meclass/nodejs.eclass15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/eclass/nodejs.eclass b/eclass/nodejs.eclass @@ -52,7 +52,17 @@ nodejs_src_compile() { # https://docs.npmjs.com/cli/v10/configuring-npm/package-json/#default-values if jq -e '.scripts | has("install")' <package.json >/dev/null then + if jq -e '.scripts | has("preinstall")' <package.json >/dev/null + then + npm "${NPM_FLAGS[@]}" run postinstall || die + fi + npm "${NPM_FLAGS[@]}" run install || die + + if jq -e '.scripts | has("postinstall")' <package.json >/dev/null + then + npm "${NPM_FLAGS[@]}" run postinstall || die + fi else if test -e binding.gyp; then if has_version -b dev-nodejs/node-gyp; then @@ -63,6 +73,11 @@ nodejs_src_compile() { fi fi fi + + if jq -e '.scripts | has("prepare")' <package.json >/dev/null + then + npm "${NPM_FLAGS[@]}" run prepare || die + fi } # Install files in nodejs hierarchy with preserving path of source files