@liquid-labs/npm-toolkit
v1.0.0-alpha.17
Published
A programmatic wrapper around key npm functions and package manipulation utilities.
Downloads
30
Readme
npm-toolkit
A programmatic wrapper around key npm functions and package data manipulation utilities.
Installation
npm i @liquid-labs/npm-toolkit
Usage
import * as fsPath from 'node:path'
import * as npm from '@liquid-labs/npm-toolkit'
const pkgDir = fsPath.join('path', 'to', 'package')
const pkgJSON = await npm.getPackageJSON(( pkgDir ))
const { name, org, basename, version } = npm.getPackageOrgBasenameAndVersion({ pkgJSON })
// alt forms:
// const { name, org, basename, version } = await getPackageOrgBasenameAndVersion({ pkgDir })
// const { name, org, basename, version } = await getPackageOrgBasenameAndVersion('@acme/foo@^1.0')
await nmp.update({ global: true })
await npm.install({ global: true, packages: ['npm-check@latest' ]})