From 959bf283ae1d55caa51eafca30a5eb04719e69d5 Mon Sep 17 00:00:00 2001 From: Branch Vincent Date: Mon, 15 Jul 2024 23:36:52 -0700 Subject: [PATCH] formula: add `std_npm_args` --- Library/Homebrew/formula.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 11ee34f31466e..e181e61bdd7bf 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1847,6 +1847,16 @@ def std_meson_args ["--prefix=#{prefix}", "--libdir=#{lib}", "--buildtype=release", "--wrap-mode=nofallback"] end + # Standard parameters for npm builds. + sig { params(prefix: T.any(String, Pathname, FalseClass)).returns(T::Array[String]) } + def std_npm_args(prefix: libexec) + require "language/node" + + return Language::Node.std_npm_install_args(Pathname(prefix)) if prefix + + Language::Node.local_npm_install_args + end + # Standard parameters for pip builds. sig { params(prefix: T.any(String, Pathname, FalseClass), @@ -2964,6 +2974,8 @@ def system(cmd, *args) pretty_args -= std_go_args when "meson" pretty_args -= std_meson_args + when "npm" + pretty_args -= std_npm_args when %r{(^|/)(pip|python)(?:[23](?:\.\d{1,2})?)?$} pretty_args -= std_pip_args end