1.0.0-alpha.17 • Published 6 months ago

@liquid-labs/npm-toolkit v1.0.0-alpha.17

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
6 months ago

npm-toolkit

coverage: 91% Unit tests

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' ]})