{"name":"nypm","version":"0.2.2","description":"Unified Package Manager for Node.js","repository":{"type":"git","url":"git+https://github.com/unjs/nypm.git"},"license":"MIT","sideEffects":false,"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"main":"./dist/index.cjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","dependencies":{"execa":"^7.1.1"},"devDependencies":{"@types/node":"^20.3.1","@vitest/coverage-v8":"^0.32.2","changelogen":"^0.5.3","corepack":"^0.18.1","eslint":"^8.43.0","eslint-config-unjs":"^0.2.1","jiti":"^1.18.2","pathe":"^1.1.1","prettier":"^2.8.8","typescript":"^5.1.3","unbuild":"^1.2.1","vitest":"^0.32.2"},"packageManager":"pnpm@8.6.1","engines":{"node":"^14.16.0 || >=16.10.0"},"scripts":{"build":"unbuild","dev":"vitest dev","lint":"eslint --ext .ts,.js,.mjs,.cjs . && prettier -c src test","lint:fix":"eslint --ext .ts,.js,.mjs,.cjs . --fix && prettier -w src test","release":"pnpm test && pnpm build && changelogen --release --push && pnpm publish","test":"pnpm lint && vitest run --coverage"},"bugs":{"url":"https://github.com/unjs/nypm/issues"},"homepage":"https://github.com/unjs/nypm#readme","_id":"nypm@0.2.2","_integrity":"sha512-O7bumfWgUXlJefT1Y41SF4vsCvzeUYmnKABuOKStheCObzrkWPDmqJc+RJVU+57oFu9bITcrUq8sKFIHgjCnTg==","_resolved":"/private/var/folders/s0/k4lcb4b50bj9r4fch4_1h_l40000gn/T/0dfcdd07c952fd7b1420267bd7d0e0a3/nypm-0.2.2.tgz","_from":"file:nypm-0.2.2.tgz","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-O7bumfWgUXlJefT1Y41SF4vsCvzeUYmnKABuOKStheCObzrkWPDmqJc+RJVU+57oFu9bITcrUq8sKFIHgjCnTg==","shasum":"6127d0dcf584c5487249b4b3216b3c137be31e22","tarball":"http://registry-npm.ywwl.com/nypm/download/nypm-0.2.2.tgz","fileCount":7,"unpackedSize":33287,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDW55bG6JTCvzFYSzZPBZxB6R65kOgCiQvPFunLjFidUwIgYFNsYqUcC6MUNa+6Z/QCLtKHiMGC/rS2dzC4RrWezKc="}],"size":5622,"noattachment":false,"key":"/nypm/-/nypm-0.2.2.tgz"},"_npmUser":{"name":"pi0","email":"pyapar@gmail.com"},"directories":{},"maintainers":[{"name":"pi0","email":"pyapar@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nypm_0.2.2_1687866714604_0.6503698769763568"},"_hasShrinkwrap":false,"readme":"# 🌈 [nypm](https://www.youtube.com/watch?v=QH2-TGUlwu4)\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![Github Actions][github-actions-src]][github-actions-href]\n[![Codecov][codecov-src]][codecov-href]\n\n> Unified Package Manager for Node.js and Bun\n\n## What does **nypm** do?\n\n✅ Supports [npm](https://docs.npmjs.com/cli/v10/commands/npm), [yarn](https://yarnpkg.com/), [pnpm](https://pnpm.io/) and [bun](https://bun.sh/package-manager) out of the box with a unified API.\n\n✅ Provides an **API interface** to interact with package managers.\n\n✅ **Autodetects** project's package manager using `package.json` and known lockfiles.\n\n✅ **Auto-installs and use exactly expected version** of supported package managers using [nodejs/corepack](https://github.com/nodejs/corepack) when available.\n\n✅ **Minimal** implementation.\n\nnypm, detects package manager type and version and converts command into package manager CLI arguments. It then uses corepack or proper command to execute package manager's command and download it if necessary.\n\n```\n  +------------------------------------------------+\n  |                nypm                            |\n  +------------------------------------------------+\n  +-----------------------------------+  +---------+\n  |              Corepack             |  |  bun    |\n  +-----------------------------------+  +---------+\n  +---------+  +---------+  +---------+\n  |   npm   |  |  yarn   |  |  pnpm   |\n  +---------+  +---------+  +---------+\n```\n\n## `nypm` Command\n\n**Install dependencies:**\n\n```sh\nnpx nypm i\n```\n\n**Add a dependency:**\n\n```sh\nnpx nypm add defu\n```\n\n**Remove a dependency:**\n\n```sh\nnpx nypm remove defu\n```\n\n## API Usage\n\nInstall package:\n\n<!-- AUTOMD_START generator=\"pm-install\" name=\"nypm\" -->\n\n```sh\n# ✨ Auto-detect\nnpx nypm i nypm\n\n# npm\nnpm install nypm\n\n# yarn\nyarn add nypm\n\n# pnpm\npnpm install nypm\n\n# bun\nbun install nypm\n```\n\n<!-- AUTOMD_END -->\n\nImport:\n\n```js\n// ESM\nimport { addDependency } from \"nypm\";\n\n// CommonJS\nconst { addDependency } = require(\"nypm\");\n```\n\n<!-- AUTOMD_START generator=\"jsdocs\" -->\n\n### `addDependency(name, options)`\n\nAdds dependency to the project.\n\n### `addDevDependency(name, options)`\n\nAdds dev dependency to the project.\n\n### `detectPackageManager(cwd, options)`\n\nDetect the package manager used in a directory (and up) by checking various sources:\n\n1. Use `packageManager` field from package.json\n2. Known lock files and other files\n\n### `ensureDependencyInstalled(name, options)`\n\nEnsures dependency is installed.\n\n### `installDependencies(options)`\n\nInstalls project dependencies.\n\n### `removeDependency(name, options)`\n\nRemoves dependency from the project.\n\n\n<!-- AUTOMD_END -->\n\n## 💻 Development\n\n- Clone this repository\n- Play [Nyan Cat](https://www.youtube.com/watch?v=QH2-TGUlwu4) in the background (really important!)\n- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable` (use `npm i -g corepack` for Node.js < 16.10)\n- Install dependencies using `pnpm install`\n- Run interactive tests using `pnpm dev`\n\n## Related Projects\n\nNYPM is inspired from previous attempts and projects for unifying package manager exeperience.\n\n- [pi0/yarnpm](https://github.com/pi0/yarnpm)\n- [unjs/lmify](https://github.com/unjs/lmify)\n- [antfu/ni](https://github.com/antfu/ni)\n- [antfu/install-pkg](https://github.com/antfu/install-pkg)\n- [egoist/dum](https://github.com/egoist/dum)\n- [nodejs/corepack](https://github.com/nodejs/corepack)\n\n## License\n\nMade with 💛\n\nPublished under [MIT License](./LICENSE).\n\n<!-- Badges -->\n\n[npm-version-src]: https://img.shields.io/npm/v/nypm?style=flat-square\n[npm-version-href]: https://npmjs.com/package/nypm\n[npm-downloads-src]: https://img.shields.io/npm/dm/nypm?style=flat-square\n[npm-downloads-href]: https://npmjs.com/package/nypm\n[github-actions-src]: https://img.shields.io/github/actions/workflow/status/unjs/nypm/ci.yml?branch=main&style=flat-square\n[github-actions-href]: https://github.com/unjs/nypm/actions?query=workflow%3Aci\n[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/nypm/main?style=flat-square\n[codecov-href]: https://codecov.io/gh/unjs/nypm\n","publish_time":1687866714787,"_cnpm_publish_time":1687866714787,"dist-tags":{"latest":"0.6.12","latest-0.1":"0.1.1"}}