Package Exports
- @roots/dependencies
Readme
@roots/dependencies
Automated package installation
Installation
Install @roots/dependencies to your project.
Yarn:
yarn add @roots/dependencies --dev
npm:
npm install @roots/dependencies --save-dev
Usage
Import the Dependencies
manager and instantiate.
The base path is required.
import { Dependencies } from "@roots/dependencies";
const manager = new Dependencies(process.cwd());
Optionally, you may also provide handlers for messages and errors:
import { Dependencies } from "@roots/dependencies";
const manager = new Dependencies(process.cwd(), console.log, console.error);
Create and use a new client:
const client = await manager.getClient();
await this.client.install(`lodash`);
await this.client.uninstall(`lodash`);
Get the latest version of a package:
const version = await this.client.getLatestVersion(`lodash`);
install a specific version with an array or a formatted string ({signifier}@{version}
):
await this.client.install([`lodash`, `latest`]);
await this.client.install(`lodash@latest`);
Supports flags:
await this.client.install([`lodash`, `latest`], `--dev`);
Contributing
Contributions are welcome from everyone.
We have contribution guidelines to help you get started.
License
@roots/dependencies is licensed under MIT.
Community
Keep track of development and community news.
- Join us on Roots Slack by becoming a GitHub sponsor
- Participate on the Roots Discourse
- Follow @rootswp on Twitter
- Read and subscribe to the Roots Blog
- Subscribe to the Roots Newsletter
Sponsors
Help support our open-source development efforts by becoming a patron.