Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Formula/react-debugger.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class ReactDebugger < Formula
desc "Advanced debugging & performance optimization tool for ReactJS applications"
homepage "https://github.com/hoainho/react-debugger-extension"
url "https://registry.npmjs.org/@nhonh/react-debugger/-/react-debugger-2.1.2.tgz"
sha256 "5398bdb6ce914c39d147ea52ba1d7d235d0292d49433dc077cbd1b58300f6f16"
license "MIT"

depends_on "node"

def install
system "npm", "install", "--production", "--ignore-scripts"
libexec.install Dir["*"]

(bin/"react-debugger").write <<~SH
#!/bin/sh
exec node "#{libexec}/bin/cli.js" "$@"
SH
Comment on lines +14 to +17

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using a bare node command in the shell wrapper relies on whatever node binary happens to be in the user's PATH at runtime. Since this formula explicitly declares depends_on "node", it is safer and more robust to use the absolute path to the Homebrew-managed Node binary.

    (bin/"react-debugger").write <<~SH
      #!/bin/sh
      exec "#{Formula["node"].opt_bin}/node" "#{libexec}/bin/cli.js" "$@"
    SH

end

test do
assert_match "2.1", shell_output("#{bin}/react-debugger --version")
end
end
34 changes: 34 additions & 0 deletions bucket/react-debugger.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"version": "2.1.2",
"description": "Advanced debugging & performance optimization tool for ReactJS applications - Chrome Extension",
"homepage": "https://github.com/hoainho/react-debugger-extension",
"license": "MIT",
"suggest": {
"Node.js": [
"main/nodejs",
"main/nodejs-lts"
]
},
"installer": {
"script": [
"npm install --global @nhonh/react-debugger@2.1.2 --prefix \"$dir\" --ignore-scripts 2>&1 | Out-Null",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Hardcoding the version 2.1.2 in the npm install command will prevent the package from upgrading correctly when the manifest version is updated (either manually or via checkver/autoupdate). Use the Scoop $version variable instead to ensure the correct version is always installed.

Suggested change
"npm install --global @nhonh/react-debugger@2.1.2 --prefix \"$dir\" --ignore-scripts 2>&1 | Out-Null",
"npm install --global @nhonh/react-debugger@$version --prefix \"$dir\" --ignore-scripts 2>&1 | Out-Null",

"if (!(Test-Path \"$dir\\bin\")) { New-Item -ItemType Directory -Path \"$dir\\bin\" | Out-Null }",
"@'",
"@echo off",
"node \"%~dp0..\\node_modules\\.bin\\react-debugger\" %*",
"'@ | Set-Content \"$dir\\bin\\react-debugger.cmd\""
]
},
"bin": "bin\\react-debugger.cmd",
"checkver": {
"url": "https://registry.npmjs.org/@nhonh/react-debugger/latest",
"jsonpath": "$.version"
},
"autoupdate": {
"note": "Update version field and re-run checkver to pick up new npm releases."
},
"notes": [
"react-debugger requires Node.js >= 18.",
"Install Node.js first: scoop install nodejs-lts"
]
}
Loading
Loading