Skip to content

Instantly share code, notes, and snippets.

@silasb
Created January 8, 2020 22:11
Show Gist options
  • Save silasb/997d084af1da46e74179f3ae1e254482 to your computer and use it in GitHub Desktop.
Save silasb/997d084af1da46e74179f3ae1e254482 to your computer and use it in GitHub Desktop.
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.19.0/yarn-v1.19.0.tar.gz"
sha256 "6bbdaab9c31eedbe7b53cbcde2be06b8c926f139bd0f7c00fccad406016e8934"
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment