installist
v1.1.0
Published
install a list of packages
Downloads
8
Maintainers
Readme
creates a listr to install a list of packages from an array of names
Why
Sometimes it's useful for a CLI to install packages into a directory. you can create a dependency list, but installation has the advantage that the user will not have to call npm install
for the packages to become available
Usage
Install the package:
npm i installist
It exports two things: an enumeration DepType
and a function insallist
. There are two DepType
values: MAIN
and DEV
.
The installist
takes 3 parameters:
- packages: string[] with the list of packages
- dir: string indicating the directory
- depType: DepType (MAIN=0 or DEV=1)
It returns a Listr, as specified in the listr package. Here's a sample usage:
import { DepType, installist } from '../src/custom/installist';
const mainInstallation = [
'barbells',
'[email protected]',
]
const codeDir='/tmp/testInstallist'
const listrToRun = await installist(mainInstallation,codeDir,DepType.MAIN)
await listrToRun.run()
This code installs into the codeDir
directory the latest versions of barbells
and version 0.1.10
of geenee-rate
. They are added to package.json
in codeDir
within dependencies
.
If DevTypes.DEV
value is used, then npm insert -D
is called for each element of the dependency list.