65 lines
2.4 KiB
Ruby
65 lines
2.4 KiB
Ruby
class NodeAT14 < Formula
|
|
desc "Platform built on V8 to build network applications"
|
|
homepage "https://nodejs.org/"
|
|
url "https://nodejs.org/dist/v14.16.0/node-v14.16.0.tar.gz"
|
|
sha256 "f6b904b06951de4c52089dd4456155d853e835b0dc4640f75458c6eb49f9e8ce"
|
|
license "MIT"
|
|
revision 1
|
|
|
|
livecheck do
|
|
url "https://nodejs.org/dist/"
|
|
regex(%r{href=["']?v?(14(?:\.\d+)+)/?["' >]}i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_big_sur: "b5d14137168e3d16c1f707463166a0a9b5ef52fb91bf4e39ecfbfa9bb171d1d1"
|
|
sha256 cellar: :any, big_sur: "a923bb6b3f5bc394b9f3fa5e5e70745ed7c1e3095e43baa9645b5ca6b0cf1189"
|
|
sha256 cellar: :any, catalina: "0767567e719f2b2abc8413a2f3f4e546ad1f5a1433ae32932976a8ecc8f21bce"
|
|
sha256 cellar: :any, mojave: "cb32fbb9b8b90bd1cdabbeeaa610dadb718627b7c4bb8224c188ba7672f821c9"
|
|
end
|
|
|
|
keg_only :versioned_formula
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "python@3.9" => :build
|
|
depends_on "icu4c"
|
|
|
|
def install
|
|
# make sure subprocesses spawned by make are using our Python 3
|
|
ENV["PYTHON"] = Formula["python@3.9"].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
|