homebrew-core/Formula/yarn.rb

37 lines
1.2 KiB
Ruby

class Yarn < Formula
desc "JavaScript package manager"
homepage "https://yarnpkg.com/"
# Should only be updated if the new version is listed as a stable release on the homepage
url "https://yarnpkg.com/downloads/1.22.5/yarn-v1.22.5.tar.gz"
sha256 "c664fb4692e4dfea750a37a533780834b40198c00cef4bbc5e8c14abab2ac141"
license "BSD-2-Clause"
livecheck do
url "https://yarnpkg.com/en/"
regex(/Stable:.*?v?(\d+(?:\.\d+)+)/im)
end
bottle :unneeded
depends_on "node"
conflicts_with "hadoop", because: "both install `yarn` binaries"
def install
libexec.install Dir["*"]
(bin/"yarn").write_env_script "#{libexec}/bin/yarn.js",
PREFIX: HOMEBREW_PREFIX,
NPM_CONFIG_PYTHON: "/usr/bin/python"
(bin/"yarnpkg").write_env_script "#{libexec}/bin/yarn.js",
PREFIX: HOMEBREW_PREFIX,
NPM_CONFIG_PYTHON: "/usr/bin/python"
inreplace "#{libexec}/package.json", '"installationMethod": "tar"', '"installationMethod": "homebrew"'
end
test do
(testpath/"package.json").write('{"name": "test"}')
system bin/"yarn", "add", "jquery"
system bin/"yarn", "add", "fsevents", "--build-from-source=true"
end
end