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