package-add
v2.0.3
Published
Programmatically install packages. Supports yarn, npm, and pnpm.
Downloads
184
Maintainers
Readme
If I should maintain this repo, please ⭐️
DM me on Twitter if you have questions or suggestions.
Programmatically install packages. Supports yarn, npm, and pnpm.
Usage
The package manager will be automatically detected:
import install from "package-add";
install("react");
// Equivalent to:
// yarn add react
// npm install react
// pnpm add react
You can also install multiple packages at once:
import install from "package-add";
install(["react", "react-dom"]);
// Equivalent to:
// yarn add react react-dom
// npm install react react-dom
// pnpm add react react-dom
Several options are available as well:
import install from "package-add";
install("lerna", {
registry: "https://registry.npmjs.org",
save: "dev",
ignoreWorkspaceRootCheck: true
});
// Equivalent to:
// yarn add lerna --registry https://registry.npmjs.org --dev --ignore-workspace-root-check
// npm install lerna --registry https://registry.npmjs.org --save-dev --ignore-workspace-root-check
// pnpm add lerna --registry https://registry.npmjs.org --save-dev --ignore-workspace-root-check
- @bconnorwhite/exec: Execute commands while keeping flags easily configurable as an object
- which-pm-lockfile: Check if a project uses yarn, npm, or pnpm
- autorepo: Autorepo abstracts away your dev dependencies, providing a single command to run all of your scripts.