npm:install
The npm:install
action installs dependencies using npm.
Usage
{
type: 'npm:install',
packages: ['express', 'pug'],
params: [],
saveDev: true,
packageManager: 'npm'
}
Options
target
Type: string
Default: process.cwd()
The directory where the packages will be installed.
packages
Type: Array<string>
Default: []
List of packages to install using npm. If no packages are provided, the action will install all dependencies from the package.json
file.
saveDev
Type: boolean
Default: false
Flag to save the packages as dev dependencies.
params
Type: Array<string>
Default: []
List of additional parameters to pass to the npm install command.
packageManager
Type: string
Default: 'npm'
The package manager to use. Can be either 'npm'
or 'yarn'
.
Examples
Install Specific Packages
import { Scaffold } from '@panda/scaffold'
new Scaffold({
name: 'install-deps',
actions: [
{
type: 'npm:install',
packages: ['express', 'pug']
}
]
})
Install All Dependencies
import { Scaffold } from '@panda/scaffold'
new Scaffold({
name: 'install-deps',
actions: [
{
type: 'npm:install'
}
]
})
Install with Additional Parameters
import { Scaffold } from '@panda/scaffold'
new Scaffold({
name: 'install-deps',
actions: [
{
type: 'npm:install',
params: ['--save-dev']
}
]
})
Install with Yarn
import { Scaffold } from '@panda/scaffold'
new Scaffold({
name: 'install-deps',
actions: [
{
type: 'npm:install',
packageManager: 'yarn'
}
]
})
Install in a Specific Directory
import { Scaffold } from '@panda/scaffold'
new Scaffold({
name: 'install-deps',
actions: [
{
type: 'npm:install',
target: 'path/to/directory'
}
]
})
Install as Dev Dependencies
import { Scaffold } from '@panda/scaffold'
new Scaffold({
name: 'install-deps',
actions: [
{
type: 'npm:install',
saveDev: true
}
]
})