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.15.1.tgz"
sha256 "8473146d7f7bf109e7edbb96f6d310e979e96d9a8f3617b7dc2bce71db871f3d"
license "MIT"
livecheck do
url "https://registry.npmjs.org/corepack/latest"
regex(/["']version["']:\s*?["']([^"']+)["']/i)
end
bottle do
sha256 cellar: :any_skip_relocation, all: "a4cbacdc773de884f55649273d1e3d185018c6f723f0411c9454ea5a525eb046"
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