-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
formula: add std_npm_args
#17774
formula: add std_npm_args
#17774
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm 👍
cc @homebrew/core for thoughts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, more consistency is always good.
(It'd be nice to get coverage on these new lines if possible, but not a blocker IMO if std_*_args
is already hard to test.)
Slight nit: when initially reading |
> std_npm_args(prefix: "./foo")
=> ["-ddd",
"--global",
"--build-from-source",
"--cache=/Users/branch/.cache/brew/npm_cache",
"--prefix=./foo",
"/tmp/test-1.0.0.tgz"]
> std_npm_args(prefix: false)
=> ["-ddd", "--build-from-source", "--cache=/Users/branch/.cache/brew/npm_cache"] I copied what we did for |
Thanks! |
Looks great, thanks @branchvincent! |
@branchvincent This change causes "RuntimeError: npm failed to pack" errors for me, when trying to install a custom formula for basedpyright (a fork of pyright) that only uses brew/Library/Homebrew/formula.rb Lines 2978 to 2979 in bdee21b
The problem occurs because Also, unlike all the other If you'd like I can make a bug report, but I haven't yet been able to find a good way to trigger the issue with a core formula. Running |
@AThePeanut4 Please open an issue for further discussion. |
Thanks for catching @AThePeanut4, fix in #17865 (ideally |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?While working on #17773, another node inconsistency that has bothered me is our npm args helper isn't exposed on the
Formula
class like all our otherstd_*_args
. This fixes that by introducing aFormula.std_npm_args
function, which for now just wraps the existing functionsBefore:
After:
Feedback welcome, if we like this I can also work on a rubocop to migrate to this new API