Socket
Socket
Sign inDemoInstall

lmify

Package Overview
Dependencies
3
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    lmify

Programmatically install NPM dependencies to the project!


Version published
Weekly downloads
468
decreased by-46.21%
Maintainers
1
Install size
448 kB
Created
Weekly downloads
 

Changelog

Source

0.3.0 (2020-04-10)

Features

  • Add fallback for npm and add test for yarn priority (3b49d82)

Readme

Source

lmify

Let me install it for you!

npm version npm downloads packagephobia Github Actions CI Codecov Dependencies Standard JS

Programmatically install NPM dependencies to the project!

Features

  • Support Yarn and NPM
  • Auto package manager detection
    • Using Yarn if yarn.lock
    • Using NPM if package-lock.json or package.json
  • Singleton or Class API
  • Optional granters

Install

Using yarn:

yarn add lmify

Using npm:

npm install lmify

Usage

install(package|packages)

Install one or more packages in rootDir using the preferred package manager.

const { install } = require('lmify')

await install('package-name')

setPackageManager(name)

Set preferred package manager to use. By default, it will be guessed.

const { setPackageManager } = require('lmify')

setPackageManager('yarn')

setRootDir(rootDir)

Set project root dir. This causes package manager detection to happen on the next install.

const { setRootDir } = require('lmify')

setRootDir(proccess.cwd())

addGranter(fn)

Add a granter function to ask the user before installing packages.

This function accepts an array of packages to be added and should return Promise<Boolean>.

Without a granter, install immediately adds package.

If multiple granters added, the first response will be used (either deny or allow).

const { addGranter } = require('lmify')

addGranter(async packages => {
  console.log('Installing packages:', packages)
  return true // Allow
})

Class: LMIFY

You can choose between using singleton instance or creating a new instance of LMIFY:

const LMIFY = require('lmify')

const constumInstance = new LMIFY(options)
options
  • stdout: Defaults to process.stdout
  • stderr: Defaults to process.stderr
  • rootDir: Defaults to process.cwd()
  • packageManager: Better if specified or install will throw a warning if no package manager is detected

License

MIT - Made with 💖 by Nuxt.js team!

FAQs

Last updated on 10 Apr 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc