百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
L

lmify

> 包管理
开源

以程序化方式安装 NPM 依赖项 (请切换到 unjs/nypm)

199 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

以程序化方式安装 NPM 依赖项 (请切换到 unjs/nypm)

lmify

Let Me Install It For You! Install NPM dependencies programmatically

This package is discontinued. Checkout unjs/nypm for a much better alternative!

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:

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.

javascript
const { install } = require('lmify')

await install('package-name')

setPackageManager(name)

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

javascript
const { setPackageManager } = require('lmify')

setPackageManager('yarn')

setRootDir(rootDir)

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

javascript
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).

javascript
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:

javascript
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!

Issues· 1 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScriptautomationinstallnodenpm

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类包管理
定价开源

> 相关工具

N
npm
Node.js 默认包管理器
P
pnpm
高效节省磁盘的 Node 包管理器
I
is-gif
Check if a Buffer/Uint8Array is a GIF image