addDependenciesToPackageJson
Signatures
addDependenciesToPackageJson(tree: Tree, dependencies: Record, devDependencies: Record, packageJsonPath: string, keepExistingVersions: boolean): 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
- tree:
Tree
- Tree representing file system to modify - dependencies:
Record
- Dependencies to be added to the dependencies section of package.json - devDependencies:
Record
- 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