commit: 271a2e00e340d5f240ac05c9dae2bc0e86ddd1ab
parent 88c7bedbdcea49055b655d67324a1817f4290991
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue, 26 Sep 2023 11:16:24 +0200
nodejs.eclass: Make npm run offline and in verbose mode
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/eclass/nodejs.eclass b/eclass/nodejs.eclass
@@ -32,11 +32,17 @@ RDEPEND="dev-nodejs/node_path"
 
 NODEJS_SITELIB="/usr/share/nodejs/"
 
+NPM_FLAGS=(
+	--audit false
+	--offline
+	--verbose
+)
+
 nodejs_src_test() {
 	if jq -e '.scripts | has("test")' <package.json >/dev/null
 	then
 		# --ignore-scripts: do not run pretest and posttest
-		npm test --ignore-scripts || die
+		npm "${NPM_FLAGS[@]}" test --ignore-scripts || die
 	else
 		die 'No "test" command defined in package.json'
 	fi
@@ -46,7 +52,7 @@ 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
-		npm run install || die
+		npm "${NPM_FLAGS[@]}" run install || die
 	else
 		if test -e binding.gyp; then
 			if has_version -b dev-nodejs/node-gyp; then