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