addDependenciesToPackageJson
▸ addDependenciesToPackageJson(tree, dependencies, devDependencies, packageJsonPath?, keepExistingVersions?): GeneratorCallback
Add Dependencies and Dev Dependencies to package.json
For example:
addDependenciesToPackageJson(tree, { react: 'latest' }, { jest: 'latest' })This will add react and jest to the dependencies and devDependencies sections of package.json respectively.
Parameters
| Name | Type | Description | 
|---|---|---|
| tree | Tree | Tree representing file system to modify | 
| dependencies | Record<string,string> | Dependencies to be added to the dependencies section of package.json | 
| devDependencies | Record<string,string> | Dependencies to be added to the devDependencies section of package.json | 
| packageJsonPath? | string | Path to package.json | 
| keepExistingVersions? | boolean | If true, prevents existing dependencies from being bumped to newer versions | 
Returns
Callback to install dependencies only if necessary, no-op otherwise