docs: recommend using `libexec.glob()` for symlinking binaries from npm modules by sushichan044 · Pull Request #21318 · Homebrew/brew

@sushichan044

Reflect the pattern commonly used in newer npm module formulae

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

Copilot AI review requested due to automatic review settings

December 24, 2025 11:52

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the documentation to recommend using the libexec.glob() method instead of Dir[] for symlinking binaries from npm modules, aligning with patterns used in newer npm module formulae.

  • Changes the recommended approach for symlinking npm module executables from Dir["#{libexec}/bin/*"] to libexec.glob("bin/*")

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sushichan044

While inspecting several npm module formulae, I noticed cases where Dir["#{libexec}/bin/*"] was replaced with libexec.glob("bin/*")

Since calling .glob() appears to be the recommended approach now, I will update the documentation to recommend using .glob().

@sushichan044

Reflect the pattern commonly used in newer npm module formulae

@sushichan044

ZhongRuoyu

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@p-linnane

If we're going this route, we should also update formula_creator:

<% elsif @mode == :node %>
system "npm", "install", *std_npm_args
bin.install_symlink Dir["\#{libexec}/bin/*"]

@MikeMcQuaid

If we're going this route, we should also update formula_creator:

Yup 👍🏻

@sushichan044

This reflecting documentation changes from Node-for-Formula-Authors.md

@sushichan044

@p-linnane
Thank you for the review. I missed this because I was only doing a simple search.

It has been fixed in e71dfda.

bevanjkay

p-linnane

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!