Skip to main content

XpmPackage.checkMinimumXpmRequired() method

Validates the minimum required xpm version against the installed CLI.

Signature

checkMinimumXpmRequired({ xpmRootFolderPath, }: {
xpmRootFolderPath: string;
}): Promise<string | undefined>;

Parameters

Parameter

Type

Description

{ xpmRootFolderPath, }

{ xpmRootFolderPath: string; }

Returns

Promise<string | undefined>

The cleaned minimum required version, or undefined if no check is required.

Exceptions

XpmPrerequisitesError If the installed xpm version is lower than the required minimum.

Remarks

This method ensures that packages requiring specific xpm features or bug fixes can enforce a minimum version requirement, preventing runtime errors or unexpected behavior with older xpm versions.

Validation workflow:

  1. Check if package is an xpm package with minimumXpmRequired set.
  2. Clean the required version by removing pre-release suffixes.
  3. Load the xpm CLI's package.json from the provided root folder.
  4. Extract and clean the installed xpm version.
  5. Compare versions using semver to determine if upgrade is needed.
  6. Throw XpmPrerequisitesError if installed version is too old.

Pre-release suffixes are stripped from both versions to ensure that pre-release builds satisfy version requirements (e.g., 1.0.0-beta satisfies minimumXpmRequired: 1.0.0).


Generated via tsdoc2docusaurus 1.3.0-pre by API Extractor/Documenter 7.55.2.