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 |
---|---|---|---|
allowMostlyStandardPackageNames | readonly | boolean | Today the npmjs.com registry enforces fairly strict naming rules for packages, but in the early days there was no standard and hardly any enforcement. A few large legacy projects are still using nonstandard package names, and private registries sometimes allow it. Set "allowMostlyStandardPackageNames" to true to relax Rush's enforcement of package names. This allows upper case letters and in the future may relax other rules, however we want to minimize these exceptions. Many popular tools use certain punctuation characters as delimiters, based on the assumption that they will never appear in a package name; thus if we relax the rules too much it is likely to cause very confusing malfunctions. The default value is false. |
approvedPackagesPolicy | readonly | ApprovedPackagesPolicy | The "approvedPackagesPolicy" settings. |
changesFolder | readonly | string | The folder that contains all change files. |
committedShrinkwrapFilename | readonly | 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.) |
commonAutoinstallersFolder | readonly | string | The fully resolved path for the "autoinstallers" folder. Example: C:\MyRepo\common\autoinstallers |
commonFolder | readonly | 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 | readonly | string | The folder where Rush's additional config files are stored. This folder is always a subfolder called Example: |
commonScriptsFolder | readonly | 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 | readonly | 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 | readonly | CommonVersionsConfiguration | Settings from the common-versions.json config file. |
currentInstalledVariant | readonly | 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 | readonly | 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: |
ensureConsistentVersions | readonly | boolean | If true, then consistent version specifiers for dependencies will be enforced. I.e. "rush check" is run before some commands. |
eventHooks | readonly | EventHooks | (BETA) The rush hooks. It allows customized scripts to run at the specified point. |
experimentsConfiguration | readonly | ExperimentsConfiguration | (BETA) This configuration object contains settings repo maintainers have specified to enable and disable experimental Rush features. |
gitAllowedEmailRegExps | readonly | 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. |
gitChangefilesCommitMessage | readonly | string | undefined | [Part of the "gitPolicy" feature.] The commit message to use when committing change log files 'rush version' |
gitChangeLogUpdateCommitMessage | readonly | string | undefined | [Part of the "gitPolicy" feature.] The commit message to use when committing change log files 'rush version' |
gitSampleEmail | readonly | 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. |
gitTagSeparator | readonly | string | undefined | [Part of the "gitPolicy" feature.] The separator between package name and version in git tag. |
gitVersionBumpCommitMessage | readonly | string | undefined | [Part of the "gitPolicy" feature.] The commit message to use when committing changes during 'rush publish' |
hotfixChangeEnabled | readonly | boolean | [Part of the "hotfixChange" feature.] Enables creating hotfix changes |
npmCacheFolder | readonly | 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: |
npmOptions | readonly | NpmOptionsConfiguration | Options that are only used when the NPM package manager is selected. |
npmTmpFolder | readonly | 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: |
packageManager | readonly | PackageManagerName | The name of the package manager being used to install dependencies |
packageManagerOptions | readonly | PackageManagerOptionsConfigurationBase | The configuration options used by the current package manager. |
packageManagerToolFilename | readonly | 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 | readonly | string | The version of the locally installed NPM tool. (Example: "1.2.3") |
packageManagerWrapper | readonly | PackageManager | (BETA) An abstraction for controlling the supported package managers: PNPM, NPM, and Yarn. |
packageNameParser | readonly | PackageNameParser | The rush hooks. It allows customized scripts to run at the specified point. |
pnpmOptions | readonly | PnpmOptionsConfiguration | Options that are only used when the PNPM package manager is selected. Use this class to load "common/config/rush/pnpm-config.json" file, or, load json from "pnpmOptions" field in "rush.json" for legacy support. |
projectFolderMaxDepth | readonly | 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 <categoryFolder>/<projectFolder>/package.json . |
projectFolderMinDepth | readonly | 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 <categoryFolder>/<projectFolder>/package.json . |
projects | readonly | RushConfigurationProject[] | |
projectsByName | readonly | Map<string, RushConfigurationProject> | |
projectsByTag | readonly | ReadonlyMap<string, ReadonlySet<RushConfigurationProject>> | (BETA) Obtains the mapping from custom tags to projects. |
repositoryDefaultBranch | readonly | string | The default branch name. This tells "rush change" which remote branch to compare against. |
repositoryDefaultFullyQualifiedRemoteBranch | readonly | string | The default fully-qualified git remote branch of the repository. This helps "rush change" find the right branch to compare against. |
repositoryDefaultRemote | readonly | string | The default remote. This tells "rush change" which remote to compare against if the remote URL is not set or if a remote matching the provided remote URL is not found. |
repositoryUrls | readonly | string[] | Remote URL(s) of the repository. If a value is provided, "rush change" will use one of these to find the right remote to compare against. Specifying multiple URLs is useful if a GitHub repository is renamed or for <projectName>.visualstudio.com versus dev.azure.com/<projectName> URLs. |
rushJsonFile | readonly | string | The absolute path to the "rush.json" configuration file that was loaded to construct this object. |
rushJsonFolder | readonly | string | The absolute path of the folder that contains rush.json for this project. |
rushLinkJsonFilename | readonly | 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: |
rushPluginOptionsFolder | readonly | string | The folder where rush-plugin options json files are stored. Example: C:\MyRepo\common\config\rush-plugins |
shrinkwrapFilename | readonly | string | The filename (without any path) of the shrinkwrap file that is used by the package manager. |
shrinkwrapFilePhrase | readonly | 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 | readonly | 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 | readonly | boolean | (BETA) Indicates whether telemetry collection is enabled for Rush runs. |
tempShrinkwrapFilename | readonly | 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 | readonly | 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 | readonly | VersionPolicyConfiguration | (BETA) |
versionPolicyConfigurationFilePath | readonly | string | (BETA) |
yarnCacheFolder | readonly | string | The local folder that will store the Yarn package cache. Example: |
yarnOptions | readonly | 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. | |
getImplicitlyPreferredVersions(variant) | Returns a map of all direct dependencies that only have a single semantic version specifier. | |
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. | |
getProjectLookupForRoot(rootPath) | (BETA) | |
getRepoState(variant) | Gets the contents from the repo-state.json file for a specific variant. | |
getRepoStateFilePath(variant) | Gets the path to the repo-state.json file for a specific variant. | |
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. | |
tryLoadFromDefaultLocation(options) | static |