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

pkg-install

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pkg-install

A wrapper making installation of Node.js packages from code easier

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

npm npm npm Build Status Codecov All Contributors

pkg-install

Easier installation of Node.js packages irrespective of the platform or package manager.

Installation

npm install pkg-install

Usage

Install a set of known dependencies to a project

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

(async () => {
  const { stdout } = await install(
    {
      twilio: '^3.1',
      'node-env-run': '~1',
      'pkg-install': undefined,
    },
    {
      dev: true,
      prefer: 'npm',
    }
  );
  console.log(stdout);
})();

Run a project install of dependencies

const { projectInstall } = require('pkg-install');

(async () => {
  const { stdout } = await projectInstall({
    prefer: 'yarn',
  });
  console.log(stdout);
})();

Documentation

Full documentation of available functions and configuration can be found on: pkg-install.dkundel.com

Known Issues

1. Disparity in supported flags

At the current moment yarn has no equivalent flags for --save-bundle or --no-save. These will be ignored when yarn has been detected as package manager.

The flags that were ignored in the run are returned as the ignoredFlags property.

2. Different behavior of modifying package.json

This library uses npm and yarn under the hood and currently npm install and yarn add have different behaviors when passing versions to the package names

For example

npm install twilio^3.1 node-env-run~1 pkg-install

Will result in the following dependencies in the package.json:

"dependencies": {
  "node-env-run": "^1.0.1",
  "pkg-install": "^0.1.1",
  "twilio": "^3.28.1"
}

While:

yarn add twilio@^3.1 node-env-run@~1 pkg-install

Will result in the following dependencies in the package.json:

"dependencies": {
  "node-env-run": "~1",
  "pkg-install": "^0.1.1",
  "twilio": "^3.1"
}

License

MIT

Contributors

Thanks goes to these wonderful people (emoji key):

Dominik Kundel
Dominik Kundel

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Keywords

FAQs

Package last updated on 18 Mar 2019

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