Last active
July 26, 2017 20:57
-
-
Save chrmoritz/80f90f86796c57d0e0519717df19e04f to your computer and use it in GitHub Desktop.
Homebrew yarn fix global installation prefix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Yarn < Formula | |
| desc "JavaScript package manager" | |
| homepage "https://yarnpkg.com/" | |
| url "https://yarnpkg.com/downloads/0.27.5/yarn-v0.27.5.tar.gz" | |
| sha256 "f0f3510246ee74eb660ea06930dcded7b684eac2593aa979a7add84b72517968" | |
| head "https://github.com/yarnpkg/yarn.git" | |
| 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment