lmify
Let me install it for you!
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
orpackage.json
- Using Yarn if
- 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 = await
setPackageManager(name)
Set preferred package manager to use. By default, it will be guessed.
const setPackageManager =
setRootDir(rootDir)
Set project root dir. This causes package manager detection to happen on the next install.
const setRootDir =
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 =
LMIFY
Class: You can choose between using singleton instance or creating a new instance of LMIFY
:
const LMIFY = const constumInstance = options
options
stdout
: Defaults toprocess.stdout
stderr
: Defaults toprocess.stderr
rootDir
: Defaults toprocess.cwd()
packageManager
: Better if specified orinstall
will throw a warning if no package manager is detected
License
MIT - Made with 💖 by Nuxt.js team!