homebrew-core/Formula/corepack.rb

41 lines
1.3 KiB
Ruby

class Corepack < Formula
require "language/node"
desc "Package acting as bridge between Node projects and their package managers"
homepage "https://github.com/nodejs/corepack"
url "https://registry.npmjs.org/corepack/-/corepack-0.14.2.tgz"
sha256 "87044250d91d77cc79f89873b18a0110586d9348bc1b083cad4186c540a273af"
license "MIT"
livecheck do
url "https://registry.npmjs.org/corepack/latest"
regex(/["']version["']:\s*?["']([^"']+)["']/i)
end
bottle do
sha256 cellar: :any_skip_relocation, all: "ae782bd56ead04ed9367fb822f68b1a457c94ebb54c29f9cb15d7cac3a6d9310"
end
depends_on "node"
conflicts_with "yarn", because: "both install `yarn` and `yarnpkg` binaries"
conflicts_with "pnpm", because: "both install `pnpm` and `pnpx` binaries"
def install
system "npm", "install", *Language::Node.std_npm_install_args(libexec)
bin.install_symlink Dir["#{libexec}/bin/*"]
end
test do
system bin/"corepack"
(testpath/"package.json").write('{"name": "test"}')
system bin/"yarn", "add", "jquery"
system bin/"yarn", "add", "fsevents", "--build-from-source=true" if OS.mac?
(testpath/"package.json").delete
system "#{bin}/pnpm", "init"
assert_predicate testpath/"package.json", :exist?, "package.json must exist"
end
end