import type { IEnvironment } from '../utilities/Utilities'; /** * @beta */ export interface IEnvironmentConfigurationInitializeOptions { doNotNormalizePaths?: boolean; } /** * Names of environment variables used by Rush. * @beta */ export declare const EnvironmentVariableNames: { /** * This variable overrides the temporary folder used by Rush. * The default value is "common/temp" under the repository root. * * @remarks This environment variable is not compatible with workspace installs. If attempting * to move the PNPM store path, see the `RUSH_PNPM_STORE_PATH` environment variable. */ readonly RUSH_TEMP_FOLDER: "RUSH_TEMP_FOLDER"; /** * This variable overrides the version of Rush that will be installed by * the version selector. The default value is determined by the "rushVersion" * field from rush.json. */ readonly RUSH_PREVIEW_VERSION: "RUSH_PREVIEW_VERSION"; /** * Frontend-owned reporter selection, including the legacy emergency override. * Engines recognize this variable without consuming its value. */ readonly RUSH_REPORTER: "RUSH_REPORTER"; /** * Frontend-owned reporter verbosity. Engines recognize this variable without consuming its value. */ readonly RUSH_LOG_LEVEL: "RUSH_LOG_LEVEL"; /** * If this variable is set to "1", Rush will not fail the build when running a version * of Node that does not match the criteria specified in the "nodeSupportedVersionRange" * field from rush.json. */ readonly RUSH_ALLOW_UNSUPPORTED_NODEJS: "RUSH_ALLOW_UNSUPPORTED_NODEJS"; /** * Setting this environment variable overrides the value of `allowWarningsInSuccessfulBuild` * in the `command-line.json` configuration file. Specify `1` to allow warnings in a successful build, * or `0` to disallow them. (See the comments in the command-line.json file for more information). */ readonly RUSH_ALLOW_WARNINGS_IN_SUCCESSFUL_BUILD: "RUSH_ALLOW_WARNINGS_IN_SUCCESSFUL_BUILD"; /** * This variable selects a specific installation variant for Rush to use when installing * and linking package dependencies. * For more information, see the command-line help for the `--variant` parameter * and this article: https://rushjs.io/pages/advanced/installation_variants/ */ readonly RUSH_VARIANT: "RUSH_VARIANT"; /** * Specifies the maximum number of concurrent processes to launch during a build. * For more information, see the command-line help for the `--parallelism` parameter for "rush build". */ readonly RUSH_PARALLELISM: "RUSH_PARALLELISM"; /** * If this variable is set to "1", Rush will create symlinks with absolute paths instead * of relative paths. This can be necessary when a repository is moved during a build or * if parts of a repository are moved into a sandbox. */ readonly RUSH_ABSOLUTE_SYMLINKS: "RUSH_ABSOLUTE_SYMLINKS"; /** * When using PNPM as the package manager, this variable can be used to configure the path that * PNPM will use as the store directory. * * If a relative path is used, then the store path will be resolved relative to the process's * current working directory. An absolute path is recommended. */ readonly RUSH_PNPM_STORE_PATH: "RUSH_PNPM_STORE_PATH"; /** * When using PNPM as the package manager, this variable can be used to control whether or not PNPM * validates the integrity of the PNPM store during installation. The value of this environment variable must be * `1` (for true) or `0` (for false). If not specified, defaults to the value in .npmrc. */ readonly RUSH_PNPM_VERIFY_STORE_INTEGRITY: "RUSH_PNPM_VERIFY_STORE_INTEGRITY"; /** * This environment variable can be used to specify the `--target-folder` parameter * for the "rush deploy" command. */ readonly RUSH_DEPLOY_TARGET_FOLDER: "RUSH_DEPLOY_TARGET_FOLDER"; /** * Overrides the location of the `~/.rush` global folder where Rush stores temporary files. * * @remarks * * Most of the temporary files created by Rush are stored separately for each monorepo working folder, * to avoid issues of concurrency and compatibility between tool versions. However, a small set * of files (e.g. installations of the `@microsoft/rush-lib` engine and the package manager) are stored * in a global folder to speed up installations. The default location is `~/.rush` on POSIX-like * operating systems or `C:\Users\YourName` on Windows. * * Use `RUSH_GLOBAL_FOLDER` to specify a different folder path. This is useful for example if a Windows * group policy forbids executing scripts installed in a user's home directory. * * POSIX is a registered trademark of the Institute of Electrical and Electronic Engineers, Inc. */ readonly RUSH_GLOBAL_FOLDER: "RUSH_GLOBAL_FOLDER"; /** * Provides a credential for a remote build cache, if configured. This credential overrides any cached credentials. * * @remarks * Setting this environment variable overrides whatever credential has been saved in the * local cloud cache credentials using `rush update-cloud-credentials`. * * * If Azure Blob Storage is used to store cache entries, this must be a SAS token serialized as query * parameters. * * For information on SAS tokens, see here: https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview */ readonly RUSH_BUILD_CACHE_CREDENTIAL: "RUSH_BUILD_CACHE_CREDENTIAL"; /** * Setting this environment variable overrides the value of `buildCacheEnabled` in the `build-cache.json` * configuration file. * * @remarks * Specify `1` to enable the build cache or `0` to disable it. * * If there is no build cache configured, then this environment variable is ignored. */ readonly RUSH_BUILD_CACHE_ENABLED: "RUSH_BUILD_CACHE_ENABLED"; /** * Overrides the value of `isCacheWriteAllowed` in the `build-cache.json` configuration file. The value of this * environment variable must be `1` (for true) or `0` (for false). If there is no build cache configured, then * this environment variable is ignored. */ readonly RUSH_BUILD_CACHE_WRITE_ALLOWED: "RUSH_BUILD_CACHE_WRITE_ALLOWED"; /** * Set this environment variable to a JSON string to override the build cache configuration that normally lives * at `common/config/rush/build-cache.json`. * * This is useful for testing purposes, or for OSS repos that are have a local-only cache, but can have * a different cache configuration in CI/CD pipelines. * * @remarks * This is similar to {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_OVERRIDE_JSON_FILE_PATH}, but it allows you to specify * a JSON string instead of a file path. The two environment variables are mutually exclusive, meaning you can * only use one of them at a time. */ readonly RUSH_BUILD_CACHE_OVERRIDE_JSON: "RUSH_BUILD_CACHE_OVERRIDE_JSON"; /** * Set this environment variable to the path to a `build-cache.json` file to override the build cache configuration * that normally lives at `common/config/rush/build-cache.json`. * * This is useful for testing purposes, or for OSS repos that are have a local-only cache, but can have * a different cache configuration in CI/CD pipelines. * * @remarks * This is similar to {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_OVERRIDE_JSON}, but it allows you to specify * a file path instead of a JSON string. The two environment variables are mutually exclusive, meaning you can * only use one of them at a time. */ readonly RUSH_BUILD_CACHE_OVERRIDE_JSON_FILE_PATH: "RUSH_BUILD_CACHE_OVERRIDE_JSON_FILE_PATH"; /** * Setting this environment variable opts into running with cobuilds. The context id should be the same across * multiple VMs, but changed when it is a new round of cobuilds. * * e.g. `Build.BuildNumber` in Azure DevOps Pipeline. * * @remarks * If there is no cobuild configured, then this environment variable is ignored. */ readonly RUSH_COBUILD_CONTEXT_ID: "RUSH_COBUILD_CONTEXT_ID"; /** * Explicitly specifies a name for each participating cobuild runner. * * Setting this environment variable opts into running with cobuilds. * * @remarks * This environment variable is optional, if it is not provided, a random id is used. * * If there is no cobuild configured, then this environment variable is ignored. */ readonly RUSH_COBUILD_RUNNER_ID: "RUSH_COBUILD_RUNNER_ID"; /** * If this variable is set to "1", When getting distributed builds, Rush will automatically handle the leaf project * with build cache "disabled" by writing to the cache in a special "log files only mode". This is useful when you * want to use Cobuilds to improve the performance in CI validations and the leaf projects have not enabled cache. */ readonly RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED: "RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED"; /** * Explicitly specifies the path for the Git binary that is invoked by certain Rush operations. */ readonly RUSH_GIT_BINARY_PATH: "RUSH_GIT_BINARY_PATH"; /** * Explicitly specifies the path for the `tar` binary that is invoked by certain Rush operations. */ readonly RUSH_TAR_BINARY_PATH: "RUSH_TAR_BINARY_PATH"; /** * Internal variable used by `rushx` when recursively invoking another `rushx` process, to avoid * nesting event hooks. */ readonly _RUSH_RECURSIVE_RUSHX_CALL: "_RUSH_RECURSIVE_RUSHX_CALL"; /** * Internal variable that explicitly specifies the path for the version of `@microsoft/rush-lib` being executed. * Will be set upon loading Rush. */ readonly _RUSH_LIB_PATH: "_RUSH_LIB_PATH"; /** * Internal variable that `rush-client` sets when it runs Rush in-process after it tried the Rush daemon: the time, * in milliseconds since the Unix epoch, until which the command waits for another Rush process to release the * repository's lock, instead of failing at once. Rush reads and removes it when it starts. */ readonly _RUSH_LOCK_WAIT_DEADLINE: "_RUSH_LOCK_WAIT_DEADLINE"; /** * Internal variable that `rush-client` sets with `_RUSH_LOCK_WAIT_DEADLINE`: the process ID of the Rush daemon * that handed the command back, so that Rush can name the daemon when it holds the repository's lock. * Rush reads and removes it when it starts. */ readonly _RUSH_LOCK_WAIT_DAEMON_PID: "_RUSH_LOCK_WAIT_DAEMON_PID"; /** * When Rush executes shell scripts, it sometimes changes the working directory to be a project folder or * the repository root folder. The original working directory (where the Rush command was invoked) is assigned * to the the child process's `RUSH_INVOKED_FOLDER` environment variable, in case it is needed by the script. * * @remarks * The `RUSH_INVOKED_FOLDER` variable is the same idea as the `INIT_CWD` variable that package managers * assign when they execute lifecycle scripts. */ readonly RUSH_INVOKED_FOLDER: "RUSH_INVOKED_FOLDER"; /** * When running a hook script, this environment variable communicates the original arguments * passed to the `rush` or `rushx` command. * * @remarks * Unlike `RUSH_INVOKED_FOLDER`, the `RUSH_INVOKED_ARGS` variable is only available for hook scripts. * Other lifecycle scripts should not make assumptions about Rush's command line syntax * if Rush did not explicitly pass along command-line parameters to their process. */ readonly RUSH_INVOKED_ARGS: "RUSH_INVOKED_ARGS"; /** * When set to `1` or `true`, this environment variable is equivalent to passing the `--quiet` flag * to `rush`, `rushx`, and `install-run-rush.ts`. It suppresses informational startup messages * while preserving error output. */ readonly RUSH_QUIET_MODE: "RUSH_QUIET_MODE"; /** Enables the opt-in standalone daemon client. */ readonly RUSH_DAEMON: "RUSH_DAEMON"; /** Overrides the daemon idle shutdown timeout. */ readonly RUSH_DAEMON_IDLE_TIMEOUT_SECONDS: "RUSH_DAEMON_IDLE_TIMEOUT_SECONDS"; /** Allows the opted-in client to start an absent daemon. */ readonly RUSH_DAEMON_AUTO_START: "RUSH_DAEMON_AUTO_START"; /** Controls persistent daemon observation of warm project files, without scheduling builds. */ readonly RUSH_DAEMON_WATCH: "RUSH_DAEMON_WATCH"; /** Enables explicitly configured persistent Node IPC operations in the daemon. */ readonly RUSH_DAEMON_USE_PERSISTENT_IPC_RUNNERS: "RUSH_DAEMON_USE_PERSISTENT_IPC_RUNNERS"; /** Lets daemon builds run an operation's guarded `:incremental` script outside watch mode. */ readonly RUSH_DAEMON_INCREMENTAL_BUILDS: "RUSH_DAEMON_INCREMENTAL_BUILDS"; /** Keeps `:incremental:ipc` watch-mode workers alive between daemon builds. */ readonly RUSH_DAEMON_WARM_WORKERS: "RUSH_DAEMON_WARM_WORKERS"; /** Lets a daemon build request add its operations to the executing iteration of a compatible batch. */ readonly RUSH_DAEMON_JOIN_RUNNING_BATCH: "RUSH_DAEMON_JOIN_RUNNING_BATCH"; /** Lets daemon operations complete before their build cache entries are written. */ readonly RUSH_DAEMON_DEFER_CACHE_WRITES: "RUSH_DAEMON_DEFER_CACHE_WRITES"; /** Lets an idle daemon load the next workspace graph and create its engine before the next request. */ readonly RUSH_DAEMON_BACKGROUND_PREPARE: "RUSH_DAEMON_BACKGROUND_PREPARE"; /** Overrides the request admission queue timeout. */ readonly RUSH_DAEMON_QUEUE_TIMEOUT_SECONDS: "RUSH_DAEMON_QUEUE_TIMEOUT_SECONDS"; /** Overrides idle eviction in an attached daemon warm set. */ readonly RUSH_DAEMON_WARM_IDLE_TIMEOUT_SECONDS: "RUSH_DAEMON_WARM_IDLE_TIMEOUT_SECONDS"; /** Overrides the attached warm set's best-effort sampled RSS budget. */ readonly RUSH_DAEMON_WARM_MEMORY_BUDGET_MB: "RUSH_DAEMON_WARM_MEMORY_BUDGET_MB"; /** Overrides the attached warm set's retained project limit. */ readonly RUSH_DAEMON_WARM_SET_MAX_PROJECTS: "RUSH_DAEMON_WARM_SET_MAX_PROJECTS"; /** Enables telemetry-weighted retention of requested work in an attached warm set. */ readonly RUSH_DAEMON_AUTO_WARM_BY_TELEMETRY: "RUSH_DAEMON_AUTO_WARM_BY_TELEMETRY"; /** Overrides the plugins that the repository has verified for long-lived daemon engines. */ readonly RUSH_DAEMON_COMPATIBLE_PLUGINS: "RUSH_DAEMON_COMPATIBLE_PLUGINS"; /** Overrides the plugins that the repository has verified to tap `runAnyPhasedCommand` the same way for every command. */ readonly RUSH_DAEMON_COMMAND_AGNOSTIC_PLUGINS: "RUSH_DAEMON_COMMAND_AGNOSTIC_PLUGINS"; /** Gates the experimental graph client; requires host graph integration. */ readonly RUSH_DAEMON_EXPERIMENTAL: "RUSH_DAEMON_EXPERIMENTAL"; }; /** * Matches the names of environment variables that are reserved for use by Rush itself. * @internal */ export declare const RUSH_ENVIRONMENT_VARIABLE_NAME_REGEXP: RegExp; /** * Provides Rush-specific environment variable data. All Rush environment variables must start with "RUSH_". This class * is designed to be used by RushConfiguration. * @beta * * @remarks * Initialize will throw if any unknown parameters are present. */ export declare class EnvironmentConfiguration { /** * If true, the environment configuration has been validated and initialized. */ static get hasBeenValidated(): boolean; /** * An override for the common/temp folder path. */ static get rushTempFolderOverride(): string | undefined; /** * If "1", create symlinks with absolute paths instead of relative paths. * See {@link EnvironmentVariableNames.RUSH_ABSOLUTE_SYMLINKS} */ static get absoluteSymlinks(): boolean; /** * If this environment variable is set to "1", the Node.js version check will print a warning * instead of causing a hard error if the environment's Node.js version doesn't match the * version specifier in `rush.json`'s "nodeSupportedVersionRange" property. * * See {@link EnvironmentVariableNames.RUSH_ALLOW_UNSUPPORTED_NODEJS}. */ static get allowUnsupportedNodeVersion(): boolean; /** * Setting this environment variable overrides the value of `allowWarningsInSuccessfulBuild` * in the `command-line.json` configuration file. Specify `1` to allow warnings in a successful build, * or `0` to disallow them. (See the comments in the command-line.json file for more information). */ static get allowWarningsInSuccessfulBuild(): boolean; /** * An override for the PNPM store path, if `pnpmStore` configuration is set to 'path' * See {@link EnvironmentVariableNames.RUSH_PNPM_STORE_PATH} */ static get pnpmStorePathOverride(): string | undefined; /** * If specified, enables or disables integrity verification of the pnpm store during install. * See {@link EnvironmentVariableNames.RUSH_PNPM_VERIFY_STORE_INTEGRITY} */ static get pnpmVerifyStoreIntegrity(): boolean | undefined; /** * Overrides the location of the `~/.rush` global folder where Rush stores temporary files. * See {@link EnvironmentVariableNames.RUSH_GLOBAL_FOLDER} */ static get rushGlobalFolderOverride(): string | undefined; /** * Provides a credential for reading from and writing to a remote build cache, if configured. * See {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_CREDENTIAL} */ static get buildCacheCredential(): string | undefined; /** * If set, enables or disables the cloud build cache feature. * See {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_ENABLED} */ static get buildCacheEnabled(): boolean | undefined; /** * If set, enables or disables writing to the cloud build cache. * See {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_WRITE_ALLOWED} */ static get buildCacheWriteAllowed(): boolean | undefined; /** * If set, overrides the build cache configuration that normally lives at `common/config/rush/build-cache.json`. * See {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_OVERRIDE_JSON} */ static get buildCacheOverrideJson(): string | undefined; /** * If set, overrides the build cache configuration that normally lives at `common/config/rush/build-cache.json`. * See {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_OVERRIDE_JSON_FILE_PATH} */ static get buildCacheOverrideJsonFilePath(): string | undefined; /** * Provides a determined cobuild context id if configured * See {@link EnvironmentVariableNames.RUSH_COBUILD_CONTEXT_ID} */ static get cobuildContextId(): string | undefined; /** * Provides a determined cobuild runner id if configured * See {@link EnvironmentVariableNames.RUSH_COBUILD_RUNNER_ID} */ static get cobuildRunnerId(): string | undefined; /** * If set, enables or disables the cobuild leaf project log only feature. * See {@link EnvironmentVariableNames.RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED} */ static get cobuildLeafProjectLogOnlyAllowed(): boolean | undefined; /** * Allows the git binary path to be explicitly provided. * See {@link EnvironmentVariableNames.RUSH_GIT_BINARY_PATH} */ static get gitBinaryPath(): string | undefined; /** * Allows the tar binary path to be explicitly provided. * See {@link EnvironmentVariableNames.RUSH_TAR_BINARY_PATH} */ static get tarBinaryPath(): string | undefined; /** * If `true`, Rush will suppress informational startup messages, equivalent to passing `--quiet`. * See {@link EnvironmentVariableNames.RUSH_QUIET_MODE} */ static get quietMode(): boolean; /** * The front-end RushVersionSelector relies on `RUSH_GLOBAL_FOLDER`, so its value must be read before * `EnvironmentConfiguration` is initialized (and actually before the correct version of `EnvironmentConfiguration` * is even installed). Thus we need to read this environment variable differently from all the others. * @internal */ static _getRushGlobalFolderOverride(processEnv: IEnvironment): string | undefined; /** * Reads and normalizes `RUSH_TEMP_FOLDER` without initializing the global environment state. * * @internal */ static _getRushTempFolderOverride(processEnv: IEnvironment): string | undefined; /** * Reads and validates environment variables. If any are invalid, this function will throw. */ static validate(options?: IEnvironmentConfigurationInitializeOptions): void; /** * Resets EnvironmentConfiguration into an un-initialized state. */ static reset(): void; static parseBooleanEnvironmentVariable(name: string, value: string | undefined): boolean | undefined; } //# sourceMappingURL=EnvironmentConfiguration.d.ts.map