class Yarn < Formula desc "JavaScript package manager" homepage "https://yarnpkg.com/" url "https://yarnpkg.com/downloads/1.2.1/yarn-v1.2.1.tar.gz" sha256 "f8ed07675c3a0b866e11a02af5c15d2f34c3aa261ab1501943ecee328786c959" bottle :unneeded depends_on "node" => :recommended def install libexec.install Dir["*"] (bin/"yarn").write_env_script "#{libexec}/bin/yarn.js", :PREFIX => HOMEBREW_PREFIX (bin/"yarnpkg").write_env_script "#{libexec}/bin/yarn.js", :PREFIX => HOMEBREW_PREFIX inreplace "#{libexec}/package.json", '"installationMethod": "tar"', '"installationMethod": "homebrew"' end test do (testpath/"package.json").write('{"name": "test"}') system bin/"yarn", "add", "jquery" end end