Home > @microsoft/rush-lib > CommonVersionsConfiguration
CommonVersionsConfiguration class
Use this class to load and save the "common/config/rush/common-versions.json" config file. This config file stores dependency version information that affects all projects in the repo.
Signature:
export declare class CommonVersionsConfiguration
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
allowedAlternativeVersions | readonly | Map<string, ReadonlyArray<string>> | A table that stores, for a given dependency, a list of SemVer ranges that will be accepted by "rush check" in addition to the normal version range. |
filePath | readonly | string | Get the absolute file path of the common-versions.json file. |
implicitlyPreferredVersions | readonly | boolean | undefined | When set to true, for all projects in the repo, all dependencies will be automatically added as preferredVersions, except in cases where different projects specify different version ranges for a given dependency. For older package managers, this tended to reduce duplication of indirect dependencies. However, it can sometimes cause trouble for indirect dependencies with incompatible peerDependencies ranges. If the value is |
preferredVersions | readonly | Map<string, string> | A table that specifies a "preferred version" for a given NPM package. This feature is typically used to hold back an indirect dependency to a specific older version, or to reduce duplication of indirect dependencies. |
Methods
Method | Modifiers | Description |
---|---|---|
getAllPreferredVersions() | Returns preferredVersions. | |
getPreferredVersionsHash() | Get a sha1 hash of the preferred versions. | |
loadFromFile(jsonFilename) | static | Loads the common-versions.json data from the specified file path. If the file has not been created yet, then an empty object is returned. |
save() | Writes the "common-versions.json" file to disk, using the filename that was passed to loadFromFile(). |