homebrew-core/Formula/prettier.rb
2018-07-25 07:13:31 -07:00

28 lines
973 B
Ruby

require "language/node"
class Prettier < Formula
desc "Code formatter for JavaScript, CSS, JSON, GraphQL, Markdown, YAML"
homepage "https://prettier.io/"
url "https://registry.npmjs.org/prettier/-/prettier-1.13.7.tgz"
sha256 "a380bed5eda687946afceb09ed56ca960dc88292cc512303f426d9640522b47a"
bottle do
cellar :any_skip_relocation
sha256 "d8ad0a3cea0d9cb906986a6201652060b0509a8c987ece7d7b2b8378e1d89282" => :high_sierra
sha256 "75261eea810825bf1ddc064cea871caffa46a13ec46e25e7d95fbf3514658cd3" => :sierra
sha256 "5df44611de806b8fce59a8b52afda14f61e416e1c7d4ae0eeab41f83950ee6da" => :el_capitan
end
depends_on "node"
def install
system "npm", "install", *Language::Node.std_npm_install_args(libexec)
bin.install_symlink Dir["#{libexec}/bin/*"]
end
test do
(testpath/"test.js").write("const arr = [1,2];")
output = shell_output("#{bin}/prettier test.js")
assert_equal "const arr = [1, 2];", output.chomp
end
end