# lmify

> Programmatically install NPM dependencies to the project!

Latest version **0.3.0** (published 2020-04-10) · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install lmify
pnpm add lmify
yarn add lmify
bun add lmify
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2020-04-10 |
| First published | 2019-03-23 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 11.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 199 |
| Maintainers | pi0 |

## Links

- npm: https://www.npmjs.com/package/lmify
- Repository: https://github.com/nuxt/lmify
- Homepage: https://github.com/nuxt/lmify#readme
- Issues: https://github.com/nuxt/lmify/issues
- npm.io page: https://npm.io/package/lmify

## Dependencies (3)

- [execa](https://npm.io/package/execa.md) ^4.0.0
- [std-env](https://npm.io/package/std-env.md) ^2.2.1
- [fs-extra](https://npm.io/package/fs-extra.md) ^9.0.0

## Recent versions

- 0.3.0 (latest) — 2020-04-10
- 0.2.2 — 2019-06-04
- 0.2.1 — 2019-06-04
- 0.2.0 — 2019-06-04
- 0.1.0 — 2019-03-23
- 0.0.0 — 2019-03-23

## README

# lmify

> Let me install it for you!

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![packagephobia][packagephobia-src]][packagephobia-href]
[![Github Actions CI][github-actions-ci-src]][github-actions-ci-href]
[![Codecov][codecov-src]][codecov-href]
[![Dependencies][david-dm-src]][david-dm-href]
[![Standard JS][standard-js-src]][standard-js-href]

Programmatically install NPM dependencies to the project!

## Features

- Support [Yarn](https://yarnpkg.com) and [NPM](https://docs.npmjs.com/cli/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:

```bash
yarn add lmify
```

Using npm:

```bash
npm install lmify
```

## Usage

### `install(package|packages)`

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

```js
const { install } = require('lmify')

await install('package-name')
```

### `setPackageManager(name)`

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

```js
const { setPackageManager } = require('lmify')

setPackageManager('yarn')
```

### `setRootDir(rootDir)`

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

```js
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).

```js
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`:


```js
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!

<!-- Badges -->
[npm-version-src]: https://flat.badgen.net/npm/dt/lmify
[npm-version-href]: https://npmjs.com/package/lmify

[npm-downloads-src]: https://flat.badgen.net/npm/v/lmify
[npm-downloads-href]: https://npmjs.com/package/lmify

[github-actions-ci-src]: https://github.com/nuxt/lmify/workflows/ci/badge.svg
[github-actions-ci-href]: https://github.com/nuxt/lmify/actions?query=workflow%3Aci

[codecov-src]: https://flat.badgen.net/codecov/c/github/nuxt/lmify
[codecov-href]: https://codecov.io/gh/nuxt/lmify

[david-dm-src]: https://flat.badgen.net/david/dep/nuxt/lmify
[david-dm-href]: https://david-dm.org/nuxt/lmify

[standard-js-src]: https://flat.badgen.net/badge/code%20style/standard/f2a
[standard-js-href]: https://standardjs.com

[packagephobia-src]: https://flat.badgen.net/packagephobia/install/lmify
[packagephobia-href]: https://packagephobia.now.sh/result?p=lmify

---
_Source: https://npm.io/package/lmify · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
