63 lines
2.3 KiB
Ruby
63 lines
2.3 KiB
Ruby
class NodeAT12 < Formula
|
|
desc "Platform built on V8 to build network applications"
|
|
homepage "https://nodejs.org/"
|
|
url "https://nodejs.org/dist/v12.18.3/node-v12.18.3.tar.xz"
|
|
sha256 "71158026579487422fd13cc2553b34cddb76519098aa6030faab52f88c6e0d0e"
|
|
|
|
livecheck do
|
|
url "https://nodejs.org/dist/"
|
|
regex(%r{href=["']?v?(12(?:\.\d+)+)/?["' >]}i)
|
|
end
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "8371625cae6cd2efa83e52a49d3c2e389e8d6be8261a0c80a710750e89ddf7d8" => :catalina
|
|
sha256 "f410b99756e3247145b43f2775d4ad00b99dcdf4366fac74c05daef7c771cb60" => :mojave
|
|
sha256 "5de456604c237daac3f9d3dd8b03cb13ce8d7c3efacf644093a4a3da4f8f1a53" => :high_sierra
|
|
end
|
|
|
|
keg_only :versioned_formula
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "python@3.8" => :build
|
|
depends_on "icu4c"
|
|
|
|
def install
|
|
# make sure subprocesses spawned by make are using our Python 3
|
|
ENV["PYTHON"] = Formula["python@3.8"].opt_bin/"python3"
|
|
|
|
system "python3", "configure.py", "--prefix=#{prefix}", "--with-intl=system-icu"
|
|
system "make", "install"
|
|
end
|
|
|
|
def post_install
|
|
(lib/"node_modules/npm/npmrc").atomic_write("prefix = #{HOMEBREW_PREFIX}\n")
|
|
end
|
|
|
|
test do
|
|
path = testpath/"test.js"
|
|
path.write "console.log('hello');"
|
|
|
|
output = shell_output("#{bin}/node #{path}").strip
|
|
assert_equal "hello", output
|
|
output = shell_output("#{bin}/node -e 'console.log(new Intl.NumberFormat(\"en-EN\").format(1234.56))'").strip
|
|
assert_equal "1,234.56", output
|
|
|
|
output = shell_output("#{bin}/node -e 'console.log(new Intl.NumberFormat(\"de-DE\").format(1234.56))'").strip
|
|
assert_equal "1.234,56", output
|
|
|
|
# make sure npm can find node
|
|
ENV.prepend_path "PATH", opt_bin
|
|
ENV.delete "NVM_NODEJS_ORG_MIRROR"
|
|
assert_equal which("node"), opt_bin/"node"
|
|
assert_predicate bin/"npm", :exist?, "npm must exist"
|
|
assert_predicate bin/"npm", :executable?, "npm must be executable"
|
|
npm_args = ["-ddd", "--cache=#{HOMEBREW_CACHE}/npm_cache", "--build-from-source"]
|
|
system "#{bin}/npm", *npm_args, "install", "npm@latest"
|
|
system "#{bin}/npm", *npm_args, "install", "bufferutil"
|
|
assert_predicate bin/"npx", :exist?, "npx must exist"
|
|
assert_predicate bin/"npx", :executable?, "npx must be executable"
|
|
assert_match "< hello >", shell_output("#{bin}/npx cowsay hello")
|
|
end
|
|
end
|