Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/unjs/lmify
🤙 Install NPM dependencies programmatically (please switch to unjs/nypm)
https://github.com/unjs/lmify
automation install node npm yarn
Last synced: 16 days ago
JSON representation
🤙 Install NPM dependencies programmatically (please switch to unjs/nypm)
- Host: GitHub
- URL: https://github.com/unjs/lmify
- Owner: unjs
- License: mit
- Archived: true
- Created: 2019-03-23T08:08:05.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2023-03-29T10:20:38.000Z (over 1 year ago)
- Last Synced: 2024-12-03T00:03:03.456Z (20 days ago)
- Topics: automation, install, node, npm, yarn
- Language: JavaScript
- Homepage: https://github.com/unjs/nypm
- Size: 346 KB
- Stars: 200
- Watchers: 3
- Forks: 12
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# lmify
> Let Me Install It For You!
> Install NPM dependencies programmatically 🤙## **This package is discontinued. Checkout [unjs/nypm](https://github.com/unjs/nypm) for a much better alternative!**
## 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`.
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!
[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