Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#248·ni

Add full support for saving peer dependencies

Author: yamcodesCreated Jan 20, 2025Updated Jan 20, 2025
Labelsenhancement

Clear and concise description of the problem

As a developer using this project, I want to install peer dependencies easily so that I can manage them using this tool.

I intend to submit a PR for this issue.

Suggested solution

  1. In ni.ts, support --peer from Yarn 1 (Classic), Yarn 2+ and bun.
  2. In ni.ts, omit the comment indicating that installing peer dependencies using Yarn and Bun programmatically is impossible.
  3. In command parsing logic, add support for --save-peer (pnpm, npm) and --peer (Yarn, Bun).
  4. Add a new subcommand for saving peers: ni -P (in line with ni -D).
  5. Add docs for step (4) into the README.md.

Alternative

  1. In step 4 of the solution, use ni -p instead, in line with ni -g.

Additional context

Workarounds

  1. (Only supports pnpm and npm) call the interactive mode ni, choose the package and choose peer mode.
  2. (Works differently for pnpm/npm and yarn/bun) call ni --save-peer for pnpm/pnpm, ni --peer for Yarn/bun.

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Source: antfu-collective/ni

View original on GitHubView discussion on GitHub