Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@antfu/install-pkg

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antfu/install-pkg

Install package programmatically.

  • 0.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
736K
decreased by-3.77%
Maintainers
1
Weekly downloads
 
Created

What is @antfu/install-pkg?

@antfu/install-pkg is a utility for programmatically installing npm packages. It simplifies the process of adding dependencies to your project by providing a straightforward API to install packages without needing to manually run npm or yarn commands.

What are @antfu/install-pkg's main functionalities?

Install a single package

This feature allows you to install a single npm package programmatically. In this example, the 'lodash' package is installed, and a message is logged upon successful installation.

const { install } = require('@antfu/install-pkg');

install('lodash').then(() => {
  console.log('Lodash installed');
});

Install multiple packages

This feature allows you to install multiple npm packages at once. In this example, both 'express' and 'mongoose' packages are installed, and a message is logged upon successful installation.

const { install } = require('@antfu/install-pkg');

install(['express', 'mongoose']).then(() => {
  console.log('Express and Mongoose installed');
});

Specify package version

This feature allows you to specify the version of the package you want to install. In this example, version 17.0.2 of the 'react' package is installed, and a message is logged upon successful installation.

const { install } = require('@antfu/install-pkg');

install('react@17.0.2').then(() => {
  console.log('React 17.0.2 installed');
});

Install devDependencies

This feature allows you to install a package as a dev dependency. In this example, the 'typescript' package is installed as a dev dependency, and a message is logged upon successful installation.

const { install } = require('@antfu/install-pkg');

install('typescript', { dev: true }).then(() => {
  console.log('TypeScript installed as a dev dependency');
});

Other packages similar to @antfu/install-pkg

FAQs

Package last updated on 28 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc