Skip to main content

functions/monorepoUpdate

Functions

lintMonorepoPackageJSONs()

function lintMonorepoPackageJSONs(monorepoRoot?): Promise<void>

Helper function to:

  • Check if all of the dependencies in the monorepo "package.json" files are up to date.
  • Check if any dependencies in the monorepo root "package.json" are unused.

This is intended to be called in a monorepo lint script. It will exit the program with an error code of 1 if discrepancies are found.

This function attempts to find the monorepo root directory automatically based on searching backwards from the file of the calling function.

Parameters

ParameterTypeDescription
monorepoRoot?stringOptional. If specified, automatic monorepo root detection will be skipped.

Returns

Promise<void>

Defined in

functions/monorepoUpdate.ts:40


updatePackageJSONDependenciesMonorepo()

function updatePackageJSONDependenciesMonorepo(monorepoRoot?): Promise<boolean>

Helper function to update the dependencies in all of the monorepo "package.json" files. If there are any updates, the package manager used in the project will be automatically invoked to install them.

This function attempts to find the monorepo root directory automatically based on searching backwards from the file of the calling function.

Parameters

ParameterTypeDescription
monorepoRoot?stringOptional. If specified, automatic monorepo root detection will be skipped.

Returns

Promise<boolean>

Whether any "package.json" files were changed.

Defined in

functions/monorepoUpdate.ts:69


updatePackageJSONDependenciesMonorepoChildren()

function updatePackageJSONDependenciesMonorepoChildren(monorepoRoot, dryRun): Promise<boolean>

Helper function to only update the dependencies in the "package.json" files of the sub-packages of a monorepo.

This will update both the normal dependencies (to match what is in the monorepo root "package.json") and the monorepo dependencies (to be what is listed in the "version" field of the respective "package.json" file).

If you need to check this in a lint script, then use the lintMonorepoPackageJSONs function instead.

Parameters

ParameterTypeDefault valueDescription
monorepoRootstringundefinedThe full path to the monorepo root directory.
dryRunbooleanfalseOptional. If true, will not modify the "package.json" files. Defaults to false.

Returns

Promise<boolean>

Whether all of the "package.json" files were valid.

Defined in

functions/monorepoUpdate.ts:103