Function: addDependenciesToPackageJson

addDependenciesToPackageJson(tree, dependencies, devDependencies, packageJsonPath?): GeneratorCallback

Add Dependencies and Dev Dependencies to package.json

For example:

1addDependenciesToPackageJson(tree, { react: 'latest' }, { jest: 'latest' }); 2

This will add react and jest to the dependencies and devDependencies sections of package.json respectively.

Parameters

NameTypeDescription
treeTreeTree representing file system to modify
dependenciesRecord<string, string>Dependencies to be added to the dependencies section of package.json
devDependenciesRecord<string, string>Dependencies to be added to the devDependencies section of package.json
packageJsonPath?stringPath to package.json

Returns

GeneratorCallback

Callback to install dependencies only if necessary, no-op otherwise