Home > @microsoft/rush-lib > RushConfiguration

RushConfiguration class

This represents the Rush configuration for a repository, based on the “rush.json” configuration file.

Signature:

export declare class RushConfiguration 

Properties

Property Modifiers Type Description
approvedPackagesPolicy   ApprovedPackagesPolicy The “approvedPackagesPolicy” settings.
changesFolder   string The folder that contains all change files.
committedShrinkwrapFilename   string The full path of the shrinkwrap file that is tracked by Git. (The “rush install” command uses a temporary copy, whose path is tempShrinkwrapFilename.)
commonFolder   string The fully resolved path for the “common” folder where Rush will store settings that affect all Rush projects. This is always a subfolder of the folder containing “rush.json”. Example: C:\MyRepo\common
commonRushConfigFolder   string The folder where Rush’s additional config files are stored. This folder is always a subfolder called config\rush inside the common folder. (The common\config folder is reserved for configuration files used by other tools.) To avoid confusion or mistakes, Rush will report an error if this this folder contains any unrecognized files.Example: C:\MyRepo\common\config\rush
commonScriptsFolder   string The folder where automation scripts are stored. This is always a subfolder called “scripts” under the common folder. Example: C:\MyRepo\common\scripts
commonTempFolder   string The folder where temporary files will be stored. This is always a subfolder called “temp” under the common folder. Example: C:\MyRepo\common\temp
commonVersions   CommonVersionsConfiguration Settings from the common-versions.json config file.
currentInstalledVariant   string | undefined Gets the currently-installed variant, if an installation has occurred. For Rush operations which do not take a –variant parameter, this method determines which variant, if any, was last specified when performing “rush install” or “rush update”.
currentVariantJsonFilename   string The filename of the variant dependency data file. By default this is called ‘current-variant.json’ resides in the Rush common folder. Its data structure is defined by ICurrentVariantJson.Example: C:\MyRepo\common\temp\current-variant.json
ensureConsistentVersions   boolean If true, then consistent version specifiers for dependencies will be enforced. I.e. “rush check” is run before some commands.
eventHooks   EventHooks (BETA) The rush hooks. It allows customized scripts to run at the specified point.
gitAllowedEmailRegExps   string[] [Part of the “gitPolicy” feature.] A list of regular expressions describing allowable email patterns for Git commits. They are case-insensitive anchored JavaScript RegExps. Example: ".*@example\.com" This array will never be undefined.
gitSampleEmail   string [Part of the “gitPolicy” feature.] An example valid email address that conforms to one of the allowedEmailRegExps. Example: "foxtrot@example\.com" This will never be undefined, and will always be nonempty if gitAllowedEmailRegExps is used.
gitVersionBumpCommitMessage   string | undefined [Part of the “gitPolicy” feature.] The commit message to use when committing changes during ‘rush publish’
hotfixChangeEnabled   boolean [Part of the “hotfixChange” feature.] Enables creating hotfix changes
npmCacheFolder   string The local folder that will store the NPM package cache. Rush does not rely on the npm’s default global cache folder, because npm’s caching implementation does not reliably handle multiple processes. (For example, if a build box is running “rush install” simultaneously for two different working folders, it may fail randomly.)Example: C:\MyRepo\common\temp\npm-cache
npmTmpFolder   string The local folder where npm’s temporary files will be written during installation. Rush does not rely on the global default folder, because it may be on a different hard disk.Example: C:\MyRepo\common\temp\npm-tmp
packageManager   PackageManagerName The name of the package manager being used to install dependencies
packageManagerToolFilename   string The absolute path to the locally installed NPM tool. If “rush install” has not been run, then this file may not exist yet. Example: C:\MyRepo\common\temp\npm-local\node_modules\.bin\npm
packageManagerToolVersion   string The version of the locally installed NPM tool. (Example: “1.2.3”)
packageManagerWrapper   PackageManager (BETA) An abstraction for controlling the supported package managers: PNPM, NPM, and Yarn.
pnpmOptions   PnpmOptionsConfiguration Options that are only used when the PNPM package manager is selected.
pnpmStoreFolder   string The local folder where PNPM stores a global installation for every installed packageExample: C:\MyRepo\common\temp\pnpm-store
projectFolderMaxDepth   number The maximum allowable folder depth for the projectFolder field in the rush.json file. This setting provides a way for repository maintainers to discourage nesting of project folders that makes the directory tree more difficult to navigate. The default value is 2, which implements on a standard convention of //package.json.
projectFolderMinDepth   number The minimum allowable folder depth for the projectFolder field in the rush.json file. This setting provides a way for repository maintainers to discourage nesting of project folders that makes the directory tree more difficult to navigate. The default value is 2, which implements a standard 2-level hierarchy of //package.json.
projects   RushConfigurationProject[]  
projectsByName   Map<string, RushConfigurationProject>  
repositoryUrl   string The remote url of the repository. This helps “rush change” find the right remote to compare against.
rushJsonFile   string The absolute path to the “rush.json” configuration file that was loaded to construct this object.
rushJsonFolder   string The absolute path of the folder that contains rush.json for this project.
rushLinkJsonFilename   string The filename of the build dependency data file. By default this is called ‘rush-link.json’ resides in the Rush common folder. Its data structure is defined by IRushLinkJson.Example: C:\MyRepo\common\temp\rush-link.json
shrinkwrapFilename   string The filename (without any path) of the shrinkwrap file that is used by the package manager.
shrinkwrapFilePhrase   string Returns an English phrase such as “shrinkwrap file” that can be used in logging messages to refer to the shrinkwrap file using appropriate terminology for the currently selected package manager.
suppressNodeLtsWarning   boolean Odd-numbered major versions of Node.js are experimental. Even-numbered releases spend six months in a stabilization period before the first Long Term Support (LTS) version. For example, 8.9.0 was the first LTS version of Node.js 8. Pre-LTS versions are not recommended for production usage because they frequently have bugs. They may cause Rush itself to malfunction.Rush normally prints a warning if it detects a pre-LTS Node.js version. If you are testing pre-LTS versions in preparation for supporting the first LTS version, you can use this setting to disable Rush’s warning.
telemetryEnabled   boolean (BETA) Indicates whether telemetry collection is enabled for Rush runs.
tempShrinkwrapFilename   string The full path of the temporary shrinkwrap file that is used during “rush install”. This file may get rewritten by the package manager during installation.
tempShrinkwrapPreinstallFilename   string The full path of a backup copy of tempShrinkwrapFilename. This backup copy is made before installation begins, and can be compared to determine how the package manager modified tempShrinkwrapFilename.
versionPolicyConfiguration   VersionPolicyConfiguration (BETA)
yarnCacheFolder   string The local folder that will store the Yarn package cache.Example: C:\MyRepo\common\temp\yarn-cache
yarnOptions   YarnOptionsConfiguration Options that are only used when the yarn package manager is selected.

Methods

Method Modifiers Description
findProjectByShorthandName(shorthandProjectName)   This is used e.g. by command-line interfaces such as “rush build –to example”. If “example” is not a project name, then it also looks for a scoped name like @something/example. If exactly one project matches this heuristic, it is returned. Otherwise, undefined is returned.
findProjectByTempName(tempProjectName)   Looks up a project by its RushConfigurationProject.tempProjectName field.
getCommittedShrinkwrapFilename(variant)   Gets the committed shrinkwrap file name for a specific variant.
getCommonVersions(variant)   Gets the settings from the common-versions.json config file for a specific variant.
getCommonVersionsFilePath(variant)   Gets the path to the common-versions.json config file for a specific variant.
getPnpmfilePath(variant)   Gets the absolute path for “pnpmfile.js” for a specific variant.
getProjectByName(projectName)   Looks up a project in the projectsByName map. If the project is not found, then undefined is returned.
loadFromConfigurationFile(rushJsonFilename) static Loads the configuration data from an Rush.json configuration file and returns an RushConfiguration object.
loadFromDefaultLocation(options) static  
tryFindRushJsonLocation(options) static Find the rush.json location and return the path, or undefined if a rush.json can’t be found.
tryGetProjectForPath(currentFolderPath)   Returns the project for which the specified path is underneath that project’s folder. If the path is not under any project’s folder, returns undefined.