Skip to content

Update

Helper functions for updating dependencies in a TypeScript project.

function updatePackageJSONDependencies(
filePathOrDirPath?,
installAfterUpdate?,
quiet?,
packagesWithoutCooldown?,
): Promise<boolean>;

Defined in: functions/update.ts:50

Helper function to run npm-check-updates to update the dependencies in the “package.json” file. If there are any updates, the package manager used in the project will be automatically invoked.

If specific versions need to be kept back, they should be placed in a “package-metadata.json” next to the respective “package.json” file like this:

{
"dependencies": {
"react": {
"lock-version": true,
"reason": "Docusaurus does not support the latest version of React."
}
}
}
Parameter Type Default value Description
filePathOrDirPath? string undefined Either the path to a “package.json” file or the path to a directory which contains a “package.json” file. If undefined is passed, the current working directory will be used.
installAfterUpdate? boolean true Optional. Whether to install the new dependencies afterward, if any. Default is true.
quiet? boolean false Optional. Whether to suppress console output. Default is false.
packagesWithoutCooldown? readonly string[] [] Optional. Package names that should be updated without applying the dependency cooldown.

Promise<boolean>

Whether the “package.json” file was updated.