@rushstack/rush-sdk 0.0.0 → 5.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2707 @@
1
+ /**
2
+ * A library for writing scripts that interact with the {@link https://rushjs.io/ | Rush} tool.
3
+ * @packageDocumentation
4
+ */
5
+
6
+ /// <reference types="node" />
7
+
8
+ import { AsyncSeriesHook } from 'tapable';
9
+ import { IPackageJson } from '@rushstack/node-core-library';
10
+ import { ITerminal } from '@rushstack/node-core-library';
11
+ import { ITerminalProvider } from '@rushstack/node-core-library';
12
+ import { JsonObject } from '@rushstack/node-core-library';
13
+ import { PackageNameParser } from '@rushstack/node-core-library';
14
+ import { Terminal } from '@rushstack/node-core-library';
15
+
16
+ /**
17
+ * This represents the JSON file specified via the "approvedPackagesFile" option in rush.json.
18
+ * @public
19
+ */
20
+ export declare class ApprovedPackagesConfiguration {
21
+ private static _jsonSchema;
22
+ items: ApprovedPackagesItem[];
23
+ private _itemsByName;
24
+ private _loadedJson;
25
+ private _jsonFilename;
26
+ constructor(jsonFilename: string);
27
+ /**
28
+ * Clears all the settings, returning to an empty state.
29
+ */
30
+ clear(): void;
31
+ getItemByName(packageName: string): ApprovedPackagesItem | undefined;
32
+ addOrUpdatePackage(packageName: string, reviewCategory: string): boolean;
33
+ /**
34
+ * If the file exists, calls loadFromFile().
35
+ */
36
+ tryLoadFromFile(approvedPackagesPolicyEnabled: boolean): boolean;
37
+ /**
38
+ * Loads the configuration data from the filename that was passed to the constructor.
39
+ */
40
+ loadFromFile(): void;
41
+ /**
42
+ * Loads the configuration data to the filename that was passed to the constructor.
43
+ */
44
+ saveToFile(): void;
45
+ /**
46
+ * Helper function only used by the constructor when loading the file.
47
+ */
48
+ private _addItemJson;
49
+ /**
50
+ * Helper function that adds an already created ApprovedPackagesItem to the
51
+ * list and set.
52
+ */
53
+ private _addItem;
54
+ }
55
+
56
+ /**
57
+ * An item returned by ApprovedPackagesConfiguration
58
+ * @public
59
+ */
60
+ export declare class ApprovedPackagesItem {
61
+ /**
62
+ * The NPM package name
63
+ */
64
+ packageName: string;
65
+ /**
66
+ * The project categories that are allowed to use this package.
67
+ */
68
+ allowedCategories: Set<string>;
69
+ /**
70
+ * @internal
71
+ */
72
+ constructor(packageName: string);
73
+ }
74
+
75
+ /**
76
+ * This is a helper object for RushConfiguration.
77
+ * It exposes the "approvedPackagesPolicy" feature from rush.json.
78
+ * @public
79
+ */
80
+ export declare class ApprovedPackagesPolicy {
81
+ private _enabled;
82
+ private _ignoredNpmScopes;
83
+ private _reviewCategories;
84
+ private _browserApprovedPackages;
85
+ private _nonbrowserApprovedPackages;
86
+ /** @internal */
87
+ constructor(rushConfiguration: RushConfiguration, rushConfigurationJson: IRushConfigurationJson);
88
+ /**
89
+ * Whether the feature is enabled. The feature is enabled if the "approvedPackagesPolicy"
90
+ * field is assigned in rush.json.
91
+ */
92
+ get enabled(): boolean;
93
+ /**
94
+ * A list of NPM package scopes that will be excluded from review (e.g. `@types`)
95
+ */
96
+ get ignoredNpmScopes(): Set<string>;
97
+ /**
98
+ * A list of category names that are valid for usage as the RushConfigurationProject.reviewCategory field.
99
+ * This array will never be undefined.
100
+ */
101
+ get reviewCategories(): Set<string>;
102
+ /**
103
+ * Packages approved for usage in a web browser. This is the stricter of the two types, so by default
104
+ * all new packages are added to this file.
105
+ *
106
+ * @remarks
107
+ *
108
+ * This is part of an optional approval workflow, whose purpose is to review any new dependencies
109
+ * that are introduced (e.g. maybe a legal review is required, or maybe we are trying to minimize bloat).
110
+ * When Rush discovers a new dependency has been added to package.json, it will update the file.
111
+ * The intent is that the file will be stored in Git and tracked by a branch policy that notifies
112
+ * reviewers when a PR attempts to modify the file.
113
+ *
114
+ * Example filename: `C:\MyRepo\common\config\rush\browser-approved-packages.json`
115
+ */
116
+ get browserApprovedPackages(): ApprovedPackagesConfiguration;
117
+ /**
118
+ * Packages approved for usage everywhere *except* in a web browser.
119
+ *
120
+ * @remarks
121
+ *
122
+ * This is part of an optional approval workflow, whose purpose is to review any new dependencies
123
+ * that are introduced (e.g. maybe a legal review is required, or maybe we are trying to minimize bloat).
124
+ * The intent is that the file will be stored in Git and tracked by a branch policy that notifies
125
+ * reviewers when a PR attempts to modify the file.
126
+ *
127
+ * Example filename: `C:\MyRepo\common\config\rush\browser-approved-packages.json`
128
+ */
129
+ get nonbrowserApprovedPackages(): ApprovedPackagesConfiguration;
130
+ }
131
+
132
+ /**
133
+ * Type of version bumps
134
+ * @public
135
+ */
136
+ export declare enum BumpType {
137
+ 'none' = 0,
138
+ 'prerelease' = 1,
139
+ 'patch' = 2,
140
+ 'preminor' = 3,
141
+ 'minor' = 4,
142
+ 'major' = 5
143
+ }
144
+
145
+ /**
146
+ * A class that helps with programmatically interacting with Rush's change files.
147
+ * @public
148
+ */
149
+ export declare class ChangeManager {
150
+ /**
151
+ * Creates a change file that has a 'none' type.
152
+ * @param rushConfiguration - The rush configuration we are working with
153
+ * @param projectName - The name of the project for which to create a change file
154
+ * @param emailAddress - The email address which should be associated with this change
155
+ * @returns the path to the file that was created, or undefined if no file was written
156
+ */
157
+ static createEmptyChangeFiles(rushConfiguration: RushConfiguration, projectName: string, emailAddress: string): string | undefined;
158
+ }
159
+
160
+ /**
161
+ * @beta
162
+ */
163
+ export declare type CloudBuildCacheProviderFactory = (buildCacheJson: IBuildCacheJson) => ICloudBuildCacheProvider;
164
+
165
+ /**
166
+ * Use this class to load and save the "common/config/rush/common-versions.json" config file.
167
+ * This config file stores dependency version information that affects all projects in the repo.
168
+ * @public
169
+ */
170
+ export declare class CommonVersionsConfiguration {
171
+ private static _jsonSchema;
172
+ private _filePath;
173
+ private _preferredVersions;
174
+ private _implicitlyPreferredVersions;
175
+ private _xstitchPreferredVersions;
176
+ private _allowedAlternativeVersions;
177
+ private _modified;
178
+ private constructor();
179
+ /**
180
+ * Loads the common-versions.json data from the specified file path.
181
+ * If the file has not been created yet, then an empty object is returned.
182
+ */
183
+ static loadFromFile(jsonFilename: string): CommonVersionsConfiguration;
184
+ private static _deserializeTable;
185
+ private static _serializeTable;
186
+ /**
187
+ * Get the absolute file path of the common-versions.json file.
188
+ */
189
+ get filePath(): string;
190
+ /**
191
+ * Get a sha1 hash of the preferred versions.
192
+ */
193
+ getPreferredVersionsHash(): string;
194
+ /**
195
+ * Writes the "common-versions.json" file to disk, using the filename that was passed to loadFromFile().
196
+ */
197
+ save(): boolean;
198
+ /**
199
+ * A table that specifies a "preferred version" for a given NPM package. This feature is typically used
200
+ * to hold back an indirect dependency to a specific older version, or to reduce duplication of indirect dependencies.
201
+ *
202
+ * @remarks
203
+ * The "preferredVersions" value can be any SemVer range specifier (e.g. `~1.2.3`). Rush injects these values into
204
+ * the "dependencies" field of the top-level common/temp/package.json, which influences how the package manager
205
+ * will calculate versions. The specific effect depends on your package manager. Generally it will have no
206
+ * effect on an incompatible or already constrained SemVer range. If you are using PNPM, similar effects can be
207
+ * achieved using the pnpmfile.js hook. See the Rush documentation for more details.
208
+ *
209
+ * After modifying this field, it's recommended to run `rush update --full` so that the package manager
210
+ * will recalculate all version selections.
211
+ */
212
+ get preferredVersions(): Map<string, string>;
213
+ /**
214
+ * When set to true, for all projects in the repo, all dependencies will be automatically added as preferredVersions,
215
+ * except in cases where different projects specify different version ranges for a given dependency. For older
216
+ * package managers, this tended to reduce duplication of indirect dependencies. However, it can sometimes cause
217
+ * trouble for indirect dependencies with incompatible peerDependencies ranges.
218
+ *
219
+ * If the value is `undefined`, then the default value is `true`.
220
+ */
221
+ get implicitlyPreferredVersions(): boolean | undefined;
222
+ /**
223
+ * A table of specifies preferred versions maintained by the XStitch tool.
224
+ *
225
+ * @remarks
226
+ * This property has the same behavior as the "preferredVersions" property, except these entries
227
+ * are automatically managed by the XStitch tool. It is an error for the same dependency name
228
+ * to appear in both tables.
229
+ */
230
+ get xstitchPreferredVersions(): Map<string, string>;
231
+ /**
232
+ * A table that stores, for a given dependency, a list of SemVer ranges that will be accepted
233
+ * by "rush check" in addition to the normal version range.
234
+ *
235
+ * @remarks
236
+ * The "rush check" command can be used to enforce that every project in the repo
237
+ * must specify the same SemVer range for a given dependency. However, sometimes
238
+ * exceptions are needed. The allowedAlternativeVersions table allows you to list
239
+ * other SemVer ranges that will be accepted by "rush check" for a given dependency.
240
+ * Note that the normal version range (as inferred by looking at all projects in the repo)
241
+ * should NOT be included in this list.
242
+ */
243
+ get allowedAlternativeVersions(): Map<string, ReadonlyArray<string>>;
244
+ /**
245
+ * Returns the union of preferredVersions and xstitchPreferredVersions.
246
+ */
247
+ getAllPreferredVersions(): Map<string, string>;
248
+ private _onSetPreferredVersions;
249
+ private _onSetAllowedAlternativeVersions;
250
+ private _serialize;
251
+ }
252
+
253
+ /**
254
+ * @beta
255
+ */
256
+ export declare class CredentialCache {
257
+ private readonly _cacheFilePath;
258
+ private readonly _cacheEntries;
259
+ private _modified;
260
+ private _disposed;
261
+ private _supportsEditing;
262
+ private readonly _lockfile;
263
+ private constructor();
264
+ static initializeAsync(options: ICredentialCacheOptions): Promise<CredentialCache>;
265
+ static usingAsync(options: ICredentialCacheOptions, doActionAsync: (credentialCache: CredentialCache) => Promise<void> | void): Promise<void>;
266
+ setCacheEntry(cacheId: string, credential: string, expires?: Date): void;
267
+ tryGetCacheEntry(cacheId: string): ICredentialCacheEntry | undefined;
268
+ deleteCacheEntry(cacheId: string): void;
269
+ trimExpiredEntries(): void;
270
+ saveIfModifiedAsync(): Promise<void>;
271
+ dispose(): void;
272
+ private _validate;
273
+ }
274
+
275
+ /**
276
+ * @public
277
+ */
278
+ export declare enum DependencyType {
279
+ Regular = "dependencies",
280
+ Dev = "devDependencies",
281
+ Optional = "optionalDependencies",
282
+ Peer = "peerDependencies",
283
+ YarnResolutions = "resolutions"
284
+ }
285
+
286
+ /**
287
+ * Provides Rush-specific environment variable data. All Rush environment variables must start with "RUSH_". This class
288
+ * is designed to be used by RushConfiguration.
289
+ * @beta
290
+ *
291
+ * @remarks
292
+ * Initialize will throw if any unknown parameters are present.
293
+ */
294
+ export declare class EnvironmentConfiguration {
295
+ private static _hasBeenValidated;
296
+ private static _rushTempFolderOverride;
297
+ private static _absoluteSymlinks;
298
+ private static _allowUnsupportedNodeVersion;
299
+ private static _allowWarningsInSuccessfulBuild;
300
+ private static _pnpmStorePathOverride;
301
+ private static _rushGlobalFolderOverride;
302
+ private static _buildCacheCredential;
303
+ private static _buildCacheEnabled;
304
+ private static _buildCacheWriteAllowed;
305
+ private static _gitBinaryPath;
306
+ private static _tarBinaryPath;
307
+ /**
308
+ * An override for the common/temp folder path.
309
+ */
310
+ static get rushTempFolderOverride(): string | undefined;
311
+ /**
312
+ * If "1", create symlinks with absolute paths instead of relative paths.
313
+ * See {@link EnvironmentVariableNames.RUSH_ABSOLUTE_SYMLINKS}
314
+ */
315
+ static get absoluteSymlinks(): boolean;
316
+ /**
317
+ * If this environment variable is set to "1", the Node.js version check will print a warning
318
+ * instead of causing a hard error if the environment's Node.js version doesn't match the
319
+ * version specifier in `rush.json`'s "nodeSupportedVersionRange" property.
320
+ *
321
+ * See {@link EnvironmentVariableNames.RUSH_ALLOW_UNSUPPORTED_NODEJS}.
322
+ */
323
+ static get allowUnsupportedNodeVersion(): boolean;
324
+ /**
325
+ * Setting this environment variable overrides the value of `allowWarningsInSuccessfulBuild`
326
+ * in the `command-line.json` configuration file. Specify `1` to allow warnings in a successful build,
327
+ * or `0` to disallow them. (See the comments in the command-line.json file for more information).
328
+ */
329
+ static get allowWarningsInSuccessfulBuild(): boolean;
330
+ /**
331
+ * An override for the PNPM store path, if `pnpmStore` configuration is set to 'path'
332
+ * See {@link EnvironmentVariableNames.RUSH_PNPM_STORE_PATH}
333
+ */
334
+ static get pnpmStorePathOverride(): string | undefined;
335
+ /**
336
+ * Overrides the location of the `~/.rush` global folder where Rush stores temporary files.
337
+ * See {@link EnvironmentVariableNames.RUSH_GLOBAL_FOLDER}
338
+ */
339
+ static get rushGlobalFolderOverride(): string | undefined;
340
+ /**
341
+ * Provides a credential for reading from and writing to a remote build cache, if configured.
342
+ * See {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_CREDENTIAL}
343
+ */
344
+ static get buildCacheCredential(): string | undefined;
345
+ /**
346
+ * If set, enables or disables the cloud build cache feature.
347
+ * See {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_ENABLED}
348
+ */
349
+ static get buildCacheEnabled(): boolean | undefined;
350
+ /**
351
+ * If set, enables or disables writing to the cloud build cache.
352
+ * See {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_WRITE_ALLOWED}
353
+ */
354
+ static get buildCacheWriteAllowed(): boolean | undefined;
355
+ /**
356
+ * Allows the git binary path to be explicitly provided.
357
+ * See {@link EnvironmentVariableNames.RUSH_GIT_BINARY_PATH}
358
+ */
359
+ static get gitBinaryPath(): string | undefined;
360
+ /**
361
+ * Allows the tar binary path to be explicitly provided.
362
+ * See {@link EnvironmentVariableNames.RUSH_TAR_BINARY_PATH}
363
+ */
364
+ static get tarBinaryPath(): string | undefined;
365
+ /**
366
+ * The front-end RushVersionSelector relies on `RUSH_GLOBAL_FOLDER`, so its value must be read before
367
+ * `EnvironmentConfiguration` is initialized (and actually before the correct version of `EnvironmentConfiguration`
368
+ * is even installed). Thus we need to read this environment variable differently from all the others.
369
+ * @internal
370
+ */
371
+ static _getRushGlobalFolderOverride(processEnv: IEnvironment): string | undefined;
372
+ /**
373
+ * Reads and validates environment variables. If any are invalid, this function will throw.
374
+ */
375
+ static validate(options?: IEnvironmentConfigurationInitializeOptions): void;
376
+ /**
377
+ * Resets EnvironmentConfiguration into an un-initialized state.
378
+ */
379
+ static reset(): void;
380
+ private static _ensureValidated;
381
+ static parseBooleanEnvironmentVariable(name: string, value: string | undefined): boolean | undefined;
382
+ /**
383
+ * Given a path to a folder (that may or may not exist), normalize the path, including casing,
384
+ * to the first existing parent folder in the path.
385
+ *
386
+ * If no existing path can be found (for example, if the root is a volume that doesn't exist),
387
+ * this function returns undefined.
388
+ *
389
+ * @example
390
+ * If the following path exists on disk: `C:\Folder1\folder2\`
391
+ * _normalizeFirstExistingFolderPath('c:\\folder1\\folder2\\temp\\subfolder')
392
+ * returns 'C:\\Folder1\\folder2\\temp\\subfolder'
393
+ */
394
+ private static _normalizeDeepestParentFolderPath;
395
+ }
396
+
397
+ /**
398
+ * Names of environment variables used by Rush.
399
+ * @beta
400
+ */
401
+ export declare enum EnvironmentVariableNames {
402
+ /**
403
+ * This variable overrides the temporary folder used by Rush.
404
+ * The default value is "common/temp" under the repository root.
405
+ *
406
+ * @remarks This environment variable is not compatible with workspace installs. If attempting
407
+ * to move the PNPM store path, see the `RUSH_PNPM_STORE_PATH` environment variable.
408
+ */
409
+ RUSH_TEMP_FOLDER = "RUSH_TEMP_FOLDER",
410
+ /**
411
+ * This variable overrides the version of Rush that will be installed by
412
+ * the version selector. The default value is determined by the "rushVersion"
413
+ * field from rush.json.
414
+ */
415
+ RUSH_PREVIEW_VERSION = "RUSH_PREVIEW_VERSION",
416
+ /**
417
+ * If this variable is set to "1", Rush will not fail the build when running a version
418
+ * of Node that does not match the criteria specified in the "nodeSupportedVersionRange"
419
+ * field from rush.json.
420
+ */
421
+ RUSH_ALLOW_UNSUPPORTED_NODEJS = "RUSH_ALLOW_UNSUPPORTED_NODEJS",
422
+ /**
423
+ * Setting this environment variable overrides the value of `allowWarningsInSuccessfulBuild`
424
+ * in the `command-line.json` configuration file. Specify `1` to allow warnings in a successful build,
425
+ * or `0` to disallow them. (See the comments in the command-line.json file for more information).
426
+ */
427
+ RUSH_ALLOW_WARNINGS_IN_SUCCESSFUL_BUILD = "RUSH_ALLOW_WARNINGS_IN_SUCCESSFUL_BUILD",
428
+ /**
429
+ * This variable selects a specific installation variant for Rush to use when installing
430
+ * and linking package dependencies.
431
+ * For more information, see the command-line help for the `--variant` parameter
432
+ * and this article: https://rushjs.io/pages/advanced/installation_variants/
433
+ */
434
+ RUSH_VARIANT = "RUSH_VARIANT",
435
+ /**
436
+ * Specifies the maximum number of concurrent processes to launch during a build.
437
+ * For more information, see the command-line help for the `--parallelism` parameter for "rush build".
438
+ */
439
+ RUSH_PARALLELISM = "RUSH_PARALLELISM",
440
+ /**
441
+ * If this variable is set to "1", Rush will create symlinks with absolute paths instead
442
+ * of relative paths. This can be necessary when a repository is moved during a build or
443
+ * if parts of a repository are moved into a sandbox.
444
+ */
445
+ RUSH_ABSOLUTE_SYMLINKS = "RUSH_ABSOLUTE_SYMLINKS",
446
+ /**
447
+ * When using PNPM as the package manager, this variable can be used to configure the path that
448
+ * PNPM will use as the store directory.
449
+ *
450
+ * If a relative path is used, then the store path will be resolved relative to the process's
451
+ * current working directory. An absolute path is recommended.
452
+ */
453
+ RUSH_PNPM_STORE_PATH = "RUSH_PNPM_STORE_PATH",
454
+ /**
455
+ * This environment variable can be used to specify the `--target-folder` parameter
456
+ * for the "rush deploy" command.
457
+ */
458
+ RUSH_DEPLOY_TARGET_FOLDER = "RUSH_DEPLOY_TARGET_FOLDER",
459
+ /**
460
+ * Overrides the location of the `~/.rush` global folder where Rush stores temporary files.
461
+ *
462
+ * @remarks
463
+ *
464
+ * Most of the temporary files created by Rush are stored separately for each monorepo working folder,
465
+ * to avoid issues of concurrency and compatibility between tool versions. However, a small set
466
+ * of files (e.g. installations of the `@microsoft/rush-lib` engine and the package manager) are stored
467
+ * in a global folder to speed up installations. The default location is `~/.rush` on POSIX-like
468
+ * operating systems or `C:\Users\YourName` on Windows.
469
+ *
470
+ * Use `RUSH_GLOBAL_FOLDER` to specify a different folder path. This is useful for example if a Windows
471
+ * group policy forbids executing scripts installed in a user's home directory.
472
+ *
473
+ * POSIX is a registered trademark of the Institute of Electrical and Electronic Engineers, Inc.
474
+ */
475
+ RUSH_GLOBAL_FOLDER = "RUSH_GLOBAL_FOLDER",
476
+ /**
477
+ * Provides a credential for a remote build cache, if configured. Setting this environment variable
478
+ * overrides whatever credential has been saved in the local cloud cache credentials using
479
+ * `rush update-cloud-credentials`.
480
+ *
481
+ * @remarks
482
+ * This credential overrides any cached credentials.
483
+ *
484
+ * If Azure Blob Storage is used to store cache entries, this must be a SAS token serialized as query
485
+ * parameters.
486
+ *
487
+ * For information on SAS tokens, see here: https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview
488
+ */
489
+ RUSH_BUILD_CACHE_CREDENTIAL = "RUSH_BUILD_CACHE_CREDENTIAL",
490
+ /**
491
+ * Setting this environment variable overrides the value of `buildCacheEnabled` in the `build-cache.json`
492
+ * configuration file. Specify `1` to enable the build cache or `0` to disable it.
493
+ *
494
+ * If set to `0`, this is equivalent to passing the `--disable-build-cache` flag.
495
+ */
496
+ RUSH_BUILD_CACHE_ENABLED = "RUSH_BUILD_CACHE_ENABLED",
497
+ /**
498
+ * Setting this environment variable overrides the value of `isCacheWriteAllowed` in the `build-cache.json`
499
+ * configuration file. Specify `1` to allow cache write and `0` to disable it.
500
+ */
501
+ RUSH_BUILD_CACHE_WRITE_ALLOWED = "RUSH_BUILD_CACHE_WRITE_ALLOWED",
502
+ /**
503
+ * Allows the git binary path to be explicitly specified.
504
+ */
505
+ RUSH_GIT_BINARY_PATH = "RUSH_GIT_BINARY_PATH",
506
+ /**
507
+ * Allows the tar binary path to be explicitly specified.
508
+ */
509
+ RUSH_TAR_BINARY_PATH = "RUSH_TAR_BINARY_PATH",
510
+ /**
511
+ * When Rush executes shell scripts, it sometimes changes the working directory to be a project folder or
512
+ * the repository root folder. The original working directory (where the Rush command was invoked) is assigned
513
+ * to the the child process's `RUSH_INVOKED_FOLDER` environment variable, in case it is needed by the script.
514
+ *
515
+ * @remarks
516
+ * The `RUSH_INVOKED_FOLDER` variable is the same idea as the `INIT_CWD` variable that package managers
517
+ * assign when they execute lifecycle scripts.
518
+ */
519
+ RUSH_INVOKED_FOLDER = "RUSH_INVOKED_FOLDER"
520
+ }
521
+
522
+ /**
523
+ * Events happen during Rush runs.
524
+ * @beta
525
+ */
526
+ export declare enum Event {
527
+ /**
528
+ * Pre Rush install event
529
+ */
530
+ preRushInstall = 1,
531
+ /**
532
+ * Post Rush install event
533
+ */
534
+ postRushInstall = 2,
535
+ /**
536
+ * Pre Rush build event
537
+ */
538
+ preRushBuild = 3,
539
+ /**
540
+ * Post Rush build event
541
+ */
542
+ postRushBuild = 4
543
+ }
544
+
545
+ /**
546
+ * This class represents Rush event hooks configured for this repo.
547
+ * Hooks are customized script actions that Rush executes when specific events occur.
548
+ * The actions are expressed as a command-line that is executed using the operating system shell.
549
+ * @beta
550
+ */
551
+ export declare class EventHooks {
552
+ private _hooks;
553
+ /**
554
+ * @internal
555
+ */
556
+ constructor(eventHooksJson: IEventHooksJson);
557
+ /**
558
+ * Return all the scripts associated with the specified event.
559
+ * @param event - Rush event
560
+ */
561
+ get(event: Event): string[];
562
+ }
563
+
564
+ /**
565
+ * Use this class to load the "common/config/rush/experiments.json" config file.
566
+ * This file allows repo maintainers to enable and disable experimental Rush features.
567
+ * @public
568
+ */
569
+ export declare class ExperimentsConfiguration {
570
+ private static _jsonSchema;
571
+ private _experimentConfiguration;
572
+ private _jsonFileName;
573
+ /**
574
+ * @internal
575
+ */
576
+ constructor(jsonFileName: string);
577
+ /**
578
+ * Get the experiments configuration.
579
+ * @beta
580
+ */
581
+ get configuration(): Readonly<IExperimentsJson>;
582
+ }
583
+
584
+ /**
585
+ * Part of IRushConfigurationJson.
586
+ */
587
+ declare interface IApprovedPackagesPolicyJson {
588
+ reviewCategories?: string[];
589
+ ignoredNpmScopes?: string[];
590
+ }
591
+
592
+ /**
593
+ * Describes the file structure for the "common/config/rush/build-cache.json" config file.
594
+ */
595
+ declare interface IBaseBuildCacheJson {
596
+ buildCacheEnabled: boolean;
597
+ cacheProvider: string;
598
+ cacheEntryNamePattern?: string;
599
+ }
600
+
601
+ /**
602
+ * @beta
603
+ */
604
+ declare type IBuildCacheJson = ICloudBuildCacheJson | ILocalBuildCacheJson;
605
+
606
+ /**
607
+ * @beta
608
+ */
609
+ declare interface ICloudBuildCacheJson extends IBaseBuildCacheJson {
610
+ readonly cacheProvider: string;
611
+ [otherConfigKey: string]: JsonObject;
612
+ }
613
+
614
+ /**
615
+ * @beta
616
+ */
617
+ export declare interface ICloudBuildCacheProvider {
618
+ readonly isCacheWriteAllowed: boolean;
619
+ tryGetCacheEntryBufferByIdAsync(terminal: ITerminal, cacheId: string): Promise<Buffer | undefined>;
620
+ trySetCacheEntryBufferAsync(terminal: ITerminal, cacheId: string, entryBuffer: Buffer): Promise<boolean>;
621
+ updateCachedCredentialAsync(terminal: ITerminal, credential: string): Promise<void>;
622
+ updateCachedCredentialInteractiveAsync(terminal: ITerminal): Promise<void>;
623
+ deleteCachedCredentialsAsync(terminal: ITerminal): Promise<void>;
624
+ }
625
+
626
+ /**
627
+ * A collection of environment variables
628
+ * @public
629
+ */
630
+ export declare interface IConfigurationEnvironment {
631
+ /**
632
+ * Environment variables
633
+ */
634
+ [environmentVariableName: string]: IConfigurationEnvironmentVariable;
635
+ }
636
+
637
+ /**
638
+ * Represents the value of an environment variable, and if the value should be overridden if the variable is set
639
+ * in the parent environment.
640
+ * @public
641
+ */
642
+ export declare interface IConfigurationEnvironmentVariable {
643
+ /**
644
+ * Value of the environment variable
645
+ */
646
+ value: string;
647
+ /**
648
+ * Set to true to override the environment variable even if it is set in the parent environment.
649
+ * The default value is false.
650
+ */
651
+ override?: boolean;
652
+ }
653
+
654
+ /**
655
+ * @beta
656
+ */
657
+ export declare interface ICredentialCacheEntry {
658
+ expires?: Date;
659
+ credential: string;
660
+ }
661
+
662
+ /**
663
+ * @beta
664
+ */
665
+ export declare interface ICredentialCacheOptions {
666
+ supportEditing: boolean;
667
+ }
668
+
669
+ declare interface IEnvironment {
670
+ [environmentVariableName: string]: string | undefined;
671
+ }
672
+
673
+ /**
674
+ * @beta
675
+ */
676
+ export declare interface IEnvironmentConfigurationInitializeOptions {
677
+ doNotNormalizePaths?: boolean;
678
+ }
679
+
680
+ /**
681
+ * Part of IRushConfigurationJson.
682
+ * @beta
683
+ */
684
+ declare interface IEventHooksJson {
685
+ /**
686
+ * The list of scripts to run after every Rush build command finishes
687
+ */
688
+ postRushBuild?: string[];
689
+ }
690
+
691
+ /**
692
+ * This interface represents the raw experiments.json file which allows repo
693
+ * maintainers to enable and disable experimental Rush features.
694
+ * @beta
695
+ */
696
+ export declare interface IExperimentsJson {
697
+ /**
698
+ * By default, 'rush install' passes --no-prefer-frozen-lockfile to 'pnpm install'.
699
+ * Set this option to true to pass '--frozen-lockfile' instead.
700
+ */
701
+ usePnpmFrozenLockfileForRushInstall?: boolean;
702
+ /**
703
+ * By default, 'rush update' passes --no-prefer-frozen-lockfile to 'pnpm install'.
704
+ * Set this option to true to pass '--prefer-frozen-lockfile' instead.
705
+ */
706
+ usePnpmPreferFrozenLockfileForRushUpdate?: boolean;
707
+ /**
708
+ * If using the 'preventManualShrinkwrapChanges' option, restricts the hash to only include the layout of external dependencies.
709
+ * Used to allow links between workspace projects or the addition/removal of references to existing dependency versions to not
710
+ * cause hash changes.
711
+ */
712
+ omitImportersFromPreventManualShrinkwrapChanges?: boolean;
713
+ /**
714
+ * If true, the chmod field in temporary project tar headers will not be normalized.
715
+ * This normalization can help ensure consistent tarball integrity across platforms.
716
+ */
717
+ noChmodFieldInTarHeaderNormalization?: boolean;
718
+ /**
719
+ * If true, build caching will respect the allowWarningsInSuccessfulBuild flag and cache builds with warnings.
720
+ * This will not replay warnings from the cached build.
721
+ */
722
+ buildCacheWithAllowWarningsInSuccessfulBuild?: boolean;
723
+ /**
724
+ * If true, the multi-phase commands feature is enabled. To use this feature, create a "phased" command
725
+ * in common/config/rush/command-line.json.
726
+ *
727
+ * THIS FEATURE IS NOT READY FOR USAGE YET. SEE GITHUB #2300 FOR STATUS.
728
+ */
729
+ _multiPhaseCommands?: boolean;
730
+ }
731
+
732
+ /**
733
+ * @beta
734
+ */
735
+ export declare interface IGetChangedProjectsOptions {
736
+ targetBranchName: string;
737
+ terminal: ITerminal;
738
+ shouldFetch?: boolean;
739
+ }
740
+
741
+ declare interface IIndividualVersionJson extends IVersionPolicyJson {
742
+ lockedMajor?: number;
743
+ }
744
+
745
+ /**
746
+ * Options to pass to the rush "launch" functions.
747
+ *
748
+ * @public
749
+ */
750
+ export declare interface ILaunchOptions {
751
+ /**
752
+ * True if the tool was invoked from within a project with a rush.json file, otherwise false. We
753
+ * consider a project without a rush.json to be "unmanaged" and we'll print that to the command line when
754
+ * the tool is executed. This is mainly used for debugging purposes.
755
+ */
756
+ isManaged: boolean;
757
+ /**
758
+ * If true, the wrapper process already printed a warning that the version of Node.js hasn't been tested
759
+ * with this version of Rush, so we shouldn't print a similar error.
760
+ */
761
+ alreadyReportedNodeTooNewError?: boolean;
762
+ }
763
+
764
+ /**
765
+ * @public
766
+ */
767
+ declare interface ILocalBuildCacheJson extends IBaseBuildCacheJson {
768
+ readonly cacheProvider: 'local-only';
769
+ }
770
+
771
+ declare interface ILockStepVersionJson extends IVersionPolicyJson {
772
+ version: string;
773
+ nextBump: string;
774
+ mainProject?: string;
775
+ }
776
+
777
+ /**
778
+ * @beta
779
+ */
780
+ export declare interface ILogger {
781
+ readonly terminal: Terminal;
782
+ /**
783
+ * Call this function to emit an error to the Rush runtime.
784
+ */
785
+ emitError(error: Error): void;
786
+ /**
787
+ * Call this function to emit a warning to the Rush runtime.
788
+ */
789
+ emitWarning(warning: Error): void;
790
+ }
791
+
792
+ /**
793
+ * This policy indicates all related projects get version bump driven by their own changes.
794
+ * @public
795
+ */
796
+ export declare class IndividualVersionPolicy extends VersionPolicy {
797
+ private _lockedMajor;
798
+ /**
799
+ * @internal
800
+ */
801
+ constructor(versionPolicyJson: IIndividualVersionJson);
802
+ /**
803
+ * The major version that has been locked
804
+ */
805
+ get lockedMajor(): number | undefined;
806
+ /**
807
+ * Serialized json for this policy
808
+ *
809
+ * @internal
810
+ */
811
+ get _json(): IIndividualVersionJson;
812
+ /**
813
+ * Returns an updated package json that satisfies the version policy.
814
+ *
815
+ * @param project - input package json
816
+ * @param force - force update even when the project version is higher than the policy version.
817
+ */
818
+ ensure(project: IPackageJson, force?: boolean): IPackageJson | undefined;
819
+ /**
820
+ * Bumps version.
821
+ * Individual version policy lets change files drive version bump. This method currently does not do anything.
822
+ *
823
+ * @param bumpType - bump type
824
+ * @param identifier - prerelease id
825
+ */
826
+ bump(bumpType?: BumpType, identifier?: string): void;
827
+ /**
828
+ * Validates the specified version and throws if the version does not satisfy the policy.
829
+ *
830
+ * @param versionString - version string
831
+ * @param packageName - package name
832
+ */
833
+ validate(versionString: string, packageName: string): void;
834
+ }
835
+
836
+ /**
837
+ * Part of IRushConfigurationJson.
838
+ * @internal
839
+ */
840
+ export declare interface _INpmOptionsJson extends IPackageManagerOptionsJsonBase {
841
+ }
842
+
843
+ /**
844
+ * Options for the package manager.
845
+ * @public
846
+ */
847
+ export declare interface IPackageManagerOptionsJsonBase {
848
+ /**
849
+ * Environment variables for the package manager
850
+ */
851
+ environmentVariables?: IConfigurationEnvironment;
852
+ }
853
+
854
+ /**
855
+ * Part of IRushConfigurationJson.
856
+ * @internal
857
+ */
858
+ export declare interface _IPnpmOptionsJson extends IPackageManagerOptionsJsonBase {
859
+ /**
860
+ * The store resolution method for PNPM to use
861
+ */
862
+ pnpmStore?: PnpmStoreOptions;
863
+ /**
864
+ * Should PNPM fail if peer dependencies aren't installed?
865
+ */
866
+ strictPeerDependencies?: boolean;
867
+ /**
868
+ * {@inheritDoc PnpmOptionsConfiguration.preventManualShrinkwrapChanges}
869
+ */
870
+ preventManualShrinkwrapChanges?: boolean;
871
+ /**
872
+ * {@inheritDoc PnpmOptionsConfiguration.useWorkspaces}
873
+ */
874
+ useWorkspaces?: boolean;
875
+ }
876
+
877
+ /**
878
+ * This represents the JSON data structure for the "rush.json" configuration file.
879
+ * See rush.schema.json for documentation.
880
+ */
881
+ declare interface IRushConfigurationJson {
882
+ $schema: string;
883
+ npmVersion?: string;
884
+ pnpmVersion?: string;
885
+ yarnVersion?: string;
886
+ rushVersion: string;
887
+ repository?: IRushRepositoryJson;
888
+ nodeSupportedVersionRange?: string;
889
+ suppressNodeLtsWarning?: boolean;
890
+ projectFolderMinDepth?: number;
891
+ projectFolderMaxDepth?: number;
892
+ allowMostlyStandardPackageNames?: boolean;
893
+ approvedPackagesPolicy?: IApprovedPackagesPolicyJson;
894
+ gitPolicy?: IRushGitPolicyJson;
895
+ telemetryEnabled?: boolean;
896
+ projects: IRushConfigurationProjectJson[];
897
+ eventHooks?: IEventHooksJson;
898
+ hotfixChangeEnabled?: boolean;
899
+ npmOptions?: _INpmOptionsJson;
900
+ pnpmOptions?: _IPnpmOptionsJson;
901
+ yarnOptions?: _IYarnOptionsJson;
902
+ ensureConsistentVersions?: boolean;
903
+ variants?: IRushVariantOptionsJson[];
904
+ }
905
+
906
+ /**
907
+ * This represents the JSON data object for a project entry in the rush.json configuration file.
908
+ */
909
+ declare interface IRushConfigurationProjectJson {
910
+ packageName: string;
911
+ projectFolder: string;
912
+ reviewCategory?: string;
913
+ cyclicDependencyProjects: string[];
914
+ versionPolicyName?: string;
915
+ shouldPublish?: boolean;
916
+ skipRushCheck?: boolean;
917
+ publishFolder?: string;
918
+ }
919
+
920
+ /**
921
+ * Part of IRushConfigurationJson.
922
+ */
923
+ declare interface IRushGitPolicyJson {
924
+ allowedEmailRegExps?: string[];
925
+ sampleEmail?: string;
926
+ versionBumpCommitMessage?: string;
927
+ changeLogUpdateCommitMessage?: string;
928
+ tagSeparator?: string;
929
+ }
930
+
931
+ /**
932
+ * @beta
933
+ */
934
+ export declare interface IRushPlugin {
935
+ apply(rushSession: RushSession, rushConfiguration: RushConfiguration): void;
936
+ }
937
+
938
+ declare interface IRushPluginConfiguration extends IRushPluginConfigurationBase {
939
+ autoinstallerName: string;
940
+ }
941
+
942
+ declare interface IRushPluginConfigurationBase {
943
+ packageName: string;
944
+ pluginName: string;
945
+ }
946
+
947
+ declare interface IRushPluginsConfigurationJson {
948
+ plugins: IRushPluginConfiguration[];
949
+ }
950
+
951
+ /**
952
+ * Part of IRushConfigurationJson.
953
+ */
954
+ declare interface IRushRepositoryJson {
955
+ /**
956
+ * The remote url of the repository. This helps "rush change" find the right remote to compare against.
957
+ */
958
+ url?: string;
959
+ /**
960
+ * The default branch name. This tells "rush change" which remote branch to compare against.
961
+ */
962
+ defaultBranch?: string;
963
+ /**
964
+ * The default remote. This tells "rush change" which remote to compare against if the remote URL is not set
965
+ * or if a remote matching the provided remote URL is not found.
966
+ */
967
+ defaultRemote?: string;
968
+ }
969
+
970
+ /**
971
+ * @beta
972
+ */
973
+ export declare interface IRushSessionOptions {
974
+ terminalProvider: ITerminalProvider;
975
+ getIsDebugMode: () => boolean;
976
+ }
977
+
978
+ /**
979
+ * Options defining an allowed variant as part of IRushConfigurationJson.
980
+ */
981
+ declare interface IRushVariantOptionsJson {
982
+ variantName: string;
983
+ description: string;
984
+ }
985
+
986
+ /**
987
+ * Options for `RushConfiguration.tryFindRushJsonLocation`.
988
+ * @public
989
+ */
990
+ export declare interface ITryFindRushJsonLocationOptions {
991
+ /**
992
+ * Whether to show verbose console messages. Defaults to false.
993
+ */
994
+ showVerbose?: boolean;
995
+ /**
996
+ * The folder path where the search will start. Defaults tot he current working directory.
997
+ */
998
+ startingFolder?: string;
999
+ }
1000
+
1001
+ declare interface IVersionPolicyDependencyJson {
1002
+ versionFormatForPublish?: VersionFormatForPublish;
1003
+ versionFormatForCommit?: VersionFormatForCommit;
1004
+ }
1005
+
1006
+ declare interface IVersionPolicyJson {
1007
+ policyName: string;
1008
+ definitionName: string;
1009
+ dependencies?: IVersionPolicyDependencyJson;
1010
+ exemptFromRushChange?: boolean;
1011
+ includeEmailInChangeFile?: boolean;
1012
+ }
1013
+
1014
+ /**
1015
+ * Part of IRushConfigurationJson.
1016
+ * @internal
1017
+ */
1018
+ export declare interface _IYarnOptionsJson extends IPackageManagerOptionsJsonBase {
1019
+ /**
1020
+ * If true, then Rush will add the "--ignore-engines" option when invoking Yarn.
1021
+ * This allows "rush install" to succeed if there are dependencies with engines defined in
1022
+ * package.json which do not match the current environment.
1023
+ *
1024
+ * The default value is false.
1025
+ */
1026
+ ignoreEngines?: boolean;
1027
+ }
1028
+
1029
+ /**
1030
+ * A helper class for managing last-install flags, which are persistent and
1031
+ * indicate that something installed in the folder was successfully completed.
1032
+ * It also compares state, so that if something like the Node.js version has changed,
1033
+ * it can invalidate the last install.
1034
+ * @internal
1035
+ */
1036
+ export declare class _LastInstallFlag {
1037
+ private _path;
1038
+ private _state;
1039
+ /**
1040
+ * Creates a new LastInstall flag
1041
+ * @param folderPath - the folder that this flag is managing
1042
+ * @param state - optional, the state that should be managed or compared
1043
+ */
1044
+ constructor(folderPath: string, state?: JsonObject);
1045
+ /**
1046
+ * Returns true if the file exists and the contents match the current state.
1047
+ */
1048
+ isValid(): boolean;
1049
+ /**
1050
+ * Same as isValid(), but with an additional check: If the current state is not equal to the previous
1051
+ * state, and an the current state causes an error, then throw an exception with a friendly message.
1052
+ *
1053
+ * @internal
1054
+ */
1055
+ checkValidAndReportStoreIssues(): boolean;
1056
+ private _isValid;
1057
+ /**
1058
+ * Writes the flag file to disk with the current state
1059
+ */
1060
+ create(): void;
1061
+ /**
1062
+ * Removes the flag file
1063
+ */
1064
+ clear(): void;
1065
+ /**
1066
+ * Returns the full path to the flag file
1067
+ */
1068
+ get path(): string;
1069
+ /**
1070
+ * Returns the name of the flag file
1071
+ */
1072
+ protected get flagName(): string;
1073
+ }
1074
+
1075
+ /**
1076
+ * This policy indicates all related projects should use the same version.
1077
+ * @public
1078
+ */
1079
+ export declare class LockStepVersionPolicy extends VersionPolicy {
1080
+ private _version;
1081
+ private _nextBump;
1082
+ private _mainProject;
1083
+ /**
1084
+ * @internal
1085
+ */
1086
+ constructor(versionPolicyJson: ILockStepVersionJson);
1087
+ /**
1088
+ * The value of the lockstep version
1089
+ */
1090
+ get version(): string;
1091
+ /**
1092
+ * The type of bump for next bump.
1093
+ */
1094
+ get nextBump(): BumpType;
1095
+ /**
1096
+ * The main project for the version policy.
1097
+ *
1098
+ * If the value is provided, change logs will only be generated in that project.
1099
+ * If the value is not provided, change logs will be hosted in each project associated with the policy.
1100
+ */
1101
+ get mainProject(): string | undefined;
1102
+ /**
1103
+ * Serialized json for this policy
1104
+ *
1105
+ * @internal
1106
+ */
1107
+ get _json(): ILockStepVersionJson;
1108
+ /**
1109
+ * Returns an updated package json that satisfies the version policy.
1110
+ *
1111
+ * @param project - input package json
1112
+ * @param force - force update even when the project version is higher than the policy version.
1113
+ */
1114
+ ensure(project: IPackageJson, force?: boolean): IPackageJson | undefined;
1115
+ /**
1116
+ * Bumps the version of the lockstep policy
1117
+ *
1118
+ * @param bumpType - Overwrite bump type in version-policy.json with the provided value.
1119
+ * @param identifier - Prerelease identifier if bump type is prerelease.
1120
+ */
1121
+ bump(bumpType?: BumpType, identifier?: string): void;
1122
+ /**
1123
+ * Updates the version of the policy directly with a new value
1124
+ * @param newVersionString - New version
1125
+ */
1126
+ update(newVersionString: string): boolean;
1127
+ /**
1128
+ * Validates the specified version and throws if the version does not satisfy lockstep version.
1129
+ *
1130
+ * @param versionString - version string
1131
+ * @param packageName - package name
1132
+ */
1133
+ validate(versionString: string, packageName: string): void;
1134
+ private _updatePackageVersion;
1135
+ private _getReleaseType;
1136
+ }
1137
+
1138
+ /**
1139
+ * This class is used to associate POSIX relative paths, such as those returned by `git` commands,
1140
+ * with entities that correspond with ancestor folders, such as Rush Projects.
1141
+ *
1142
+ * It is optimized for efficiently locating the nearest ancestor path with an associated value.
1143
+ *
1144
+ * @example
1145
+ * ```ts
1146
+ * const tree = new LookupByPath([['foo', 1], ['bar', 2], ['foo/bar', 3]]);
1147
+ * tree.getNearestAncestor('foo'); // returns 1
1148
+ * tree.getNearestAncestor('foo/baz'); // returns 1
1149
+ * tree.getNearestAncestor('baz'); // returns undefined
1150
+ * tree.getNearestAncestor('foo/bar/baz'); returns 3
1151
+ * tree.getNearestAncestor('bar/foo/bar'); returns 2
1152
+ * ```
1153
+ * @beta
1154
+ */
1155
+ export declare class LookupByPath<TItem> {
1156
+ /**
1157
+ * The delimiter used to split paths
1158
+ */
1159
+ readonly delimiter: string;
1160
+ /**
1161
+ * The root node of the tree, corresponding to the path ''
1162
+ */
1163
+ private readonly _root;
1164
+ /**
1165
+ * Constructs a new `LookupByPath`
1166
+ *
1167
+ * @param entries - Initial path-value pairs to populate the tree.
1168
+ */
1169
+ constructor(entries?: Iterable<[string, TItem]>, delimiter?: string);
1170
+ /**
1171
+ * Iterates over the segments of a serialized path.
1172
+ *
1173
+ * @example
1174
+ *
1175
+ * `LookupByPath.iteratePathSegments('foo/bar/baz')` yields 'foo', 'bar', 'baz'
1176
+ *
1177
+ * `LookupByPath.iteratePathSegments('foo\\bar\\baz', '\\')` yields 'foo', 'bar', 'baz'
1178
+ */
1179
+ static iteratePathSegments(serializedPath: string, delimiter?: string): Iterable<string>;
1180
+ /**
1181
+ * Associates the value with the specified serialized path.
1182
+ * If a value is already associated, will overwrite.
1183
+ *
1184
+ * @returns this, for chained calls
1185
+ */
1186
+ setItem(serializedPath: string, value: TItem): this;
1187
+ /**
1188
+ * Associates the value with the specified path.
1189
+ * If a value is already associated, will overwrite.
1190
+ *
1191
+ * @returns this, for chained calls
1192
+ */
1193
+ setItemFromSegments(pathSegments: Iterable<string>, value: TItem): this;
1194
+ /**
1195
+ * Searches for the item associated with `childPath`, or the nearest ancestor of that path that
1196
+ * has an associated item.
1197
+ *
1198
+ * @returns the found item, or `undefined` if no item was found
1199
+ *
1200
+ * @example
1201
+ * ```ts
1202
+ * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
1203
+ * tree.findChildPath('foo/baz'); // returns 1
1204
+ * tree.findChildPath('foo/bar/baz'); // returns 2
1205
+ * ```
1206
+ */
1207
+ findChildPath(childPath: string): TItem | undefined;
1208
+ /**
1209
+ * Searches for the item associated with `childPathSegments`, or the nearest ancestor of that path that
1210
+ * has an associated item.
1211
+ *
1212
+ * @returns the found item, or `undefined` if no item was found
1213
+ *
1214
+ * @example
1215
+ * ```ts
1216
+ * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
1217
+ * tree.findChildPathFromSegments(['foo', 'baz']); // returns 1
1218
+ * tree.findChildPathFromSegments(['foo','bar', 'baz']); // returns 2
1219
+ * ```
1220
+ */
1221
+ findChildPathFromSegments(childPathSegments: Iterable<string>): TItem | undefined;
1222
+ }
1223
+
1224
+ /**
1225
+ * Options that are only used when the NPM package manager is selected.
1226
+ *
1227
+ * @remarks
1228
+ * It is valid to define these options in rush.json even if the NPM package manager
1229
+ * is not being used.
1230
+ *
1231
+ * @public
1232
+ */
1233
+ export declare class NpmOptionsConfiguration extends PackageManagerOptionsConfigurationBase {
1234
+ /** @internal */
1235
+ constructor(json: _INpmOptionsJson);
1236
+ }
1237
+
1238
+ /**
1239
+ * @public
1240
+ */
1241
+ export declare class PackageJsonDependency {
1242
+ private _type;
1243
+ private _name;
1244
+ private _version;
1245
+ private _onChange;
1246
+ constructor(name: string, version: string, type: DependencyType, onChange: () => void);
1247
+ get name(): string;
1248
+ get version(): string;
1249
+ setVersion(newVersion: string): void;
1250
+ get dependencyType(): DependencyType;
1251
+ }
1252
+
1253
+ /**
1254
+ * @public
1255
+ */
1256
+ export declare class PackageJsonEditor {
1257
+ private readonly _filePath;
1258
+ private readonly _dependencies;
1259
+ private readonly _devDependencies;
1260
+ private readonly _resolutions;
1261
+ private _modified;
1262
+ private _sourceData;
1263
+ private constructor();
1264
+ static load(filePath: string): PackageJsonEditor;
1265
+ static fromObject(object: IPackageJson, filename: string): PackageJsonEditor;
1266
+ get name(): string;
1267
+ get version(): string;
1268
+ get filePath(): string;
1269
+ /**
1270
+ * The list of dependencies of type DependencyType.Regular, DependencyType.Optional, or DependencyType.Peer.
1271
+ */
1272
+ get dependencyList(): ReadonlyArray<PackageJsonDependency>;
1273
+ /**
1274
+ * The list of dependencies of type DependencyType.Dev.
1275
+ */
1276
+ get devDependencyList(): ReadonlyArray<PackageJsonDependency>;
1277
+ /**
1278
+ * This field is a Yarn-specific feature that allows overriding of package resolution.
1279
+ *
1280
+ * @remarks
1281
+ * See the {@link https://github.com/yarnpkg/rfcs/blob/master/implemented/0000-selective-versions-resolutions.md
1282
+ * | 0000-selective-versions-resolutions.md RFC} for details.
1283
+ */
1284
+ get resolutionsList(): ReadonlyArray<PackageJsonDependency>;
1285
+ tryGetDependency(packageName: string): PackageJsonDependency | undefined;
1286
+ tryGetDevDependency(packageName: string): PackageJsonDependency | undefined;
1287
+ addOrUpdateDependency(packageName: string, newVersion: string, dependencyType: DependencyType): void;
1288
+ saveIfModified(): boolean;
1289
+ /**
1290
+ * Get the normalized package.json that represents the current state of the
1291
+ * PackageJsonEditor. This method does not save any changes that were made to the
1292
+ * package.json, but instead returns the object representation of what would be saved
1293
+ * if saveIfModified() is called.
1294
+ */
1295
+ saveToObject(): IPackageJson;
1296
+ private _onChange;
1297
+ /**
1298
+ * Create a normalized shallow copy of the provided package.json without modifying the
1299
+ * original. If the result of this method is being returned via a public facing method,
1300
+ * it will still need to be deep-cloned to avoid propogating changes back to the
1301
+ * original dataset.
1302
+ */
1303
+ private _normalize;
1304
+ }
1305
+
1306
+ /**
1307
+ * An abstraction for controlling the supported package managers: PNPM, NPM, and Yarn.
1308
+ * @public
1309
+ */
1310
+ export declare abstract class PackageManager {
1311
+ /**
1312
+ * The package manager.
1313
+ */
1314
+ readonly packageManager: PackageManagerName;
1315
+ /**
1316
+ * The SemVer version of the package manager.
1317
+ */
1318
+ readonly version: string;
1319
+ protected _shrinkwrapFilename: string;
1320
+ /** @internal */
1321
+ protected constructor(version: string, packageManager: PackageManagerName);
1322
+ /**
1323
+ * The filename of the shrinkwrap file that is used by the package manager.
1324
+ *
1325
+ * @remarks
1326
+ * Example: `npm-shrinkwrap.json` or `pnpm-lock.yaml`
1327
+ */
1328
+ get shrinkwrapFilename(): string;
1329
+ }
1330
+
1331
+ /**
1332
+ * This represents the available Package Manager tools as a string
1333
+ * @public
1334
+ */
1335
+ export declare type PackageManagerName = 'pnpm' | 'npm' | 'yarn';
1336
+
1337
+ /**
1338
+ * Options that all package managers share.
1339
+ *
1340
+ * @public
1341
+ */
1342
+ export declare abstract class PackageManagerOptionsConfigurationBase implements IPackageManagerOptionsJsonBase {
1343
+ /**
1344
+ * Environment variables for the package manager
1345
+ */
1346
+ readonly environmentVariables?: IConfigurationEnvironment;
1347
+ /** @internal */
1348
+ protected constructor(json: IPackageManagerOptionsJsonBase);
1349
+ }
1350
+
1351
+ /**
1352
+ * Options that are only used when the PNPM package manager is selected.
1353
+ *
1354
+ * @remarks
1355
+ * It is valid to define these options in rush.json even if the PNPM package manager
1356
+ * is not being used.
1357
+ *
1358
+ * @public
1359
+ */
1360
+ export declare class PnpmOptionsConfiguration extends PackageManagerOptionsConfigurationBase {
1361
+ /**
1362
+ * The method used to resolve the store used by PNPM.
1363
+ *
1364
+ * @remarks
1365
+ * Available options:
1366
+ * - local: Use the standard Rush store path: common/temp/pnpm-store
1367
+ * - global: Use PNPM's global store path
1368
+ */
1369
+ readonly pnpmStore: PnpmStoreOptions;
1370
+ /**
1371
+ * The path for PNPM to use as the store directory.
1372
+ *
1373
+ * Will be overridden by environment variable RUSH_PNPM_STORE_PATH
1374
+ */
1375
+ readonly pnpmStorePath: string;
1376
+ /**
1377
+ * If true, then Rush will add the "--strict-peer-dependencies" option when invoking PNPM.
1378
+ *
1379
+ * @remarks
1380
+ * This causes "rush install" to fail if there are unsatisfied peer dependencies, which is
1381
+ * an invalid state that can cause build failures or incompatible dependency versions.
1382
+ * (For historical reasons, JavaScript package managers generally do not treat this invalid state
1383
+ * as an error.)
1384
+ *
1385
+ * The default value is false. (For now.)
1386
+ */
1387
+ readonly strictPeerDependencies: boolean;
1388
+ /**
1389
+ * If true, then `rush install` will report an error if manual modifications
1390
+ * were made to the PNPM shrinkwrap file without running `rush update` afterwards.
1391
+ *
1392
+ * @remarks
1393
+ * This feature protects against accidental inconsistencies that may be introduced
1394
+ * if the PNPM shrinkwrap file (`pnpm-lock.yaml`) is manually edited. When this
1395
+ * feature is enabled, `rush update` will write a hash of the shrinkwrap contents to repo-state.json,
1396
+ * and then `rush update` and `rush install` will validate the hash. Note that this does not prohibit
1397
+ * manual modifications, but merely requires `rush update` be run
1398
+ * afterwards, ensuring that PNPM can report or repair any potential inconsistencies.
1399
+ *
1400
+ * To temporarily disable this validation when invoking `rush install`, use the
1401
+ * `--bypass-policy` command-line parameter.
1402
+ *
1403
+ * The default value is false.
1404
+ */
1405
+ readonly preventManualShrinkwrapChanges: boolean;
1406
+ /**
1407
+ * If true, then Rush will use the workspaces feature to install and link packages when invoking PNPM.
1408
+ *
1409
+ * @remarks
1410
+ * The default value is false. (For now.)
1411
+ */
1412
+ readonly useWorkspaces: boolean;
1413
+ /** @internal */
1414
+ constructor(json: _IPnpmOptionsJson, commonTempFolder: string);
1415
+ }
1416
+
1417
+ /**
1418
+ * This represents the available PNPM store options
1419
+ * @public
1420
+ */
1421
+ export declare type PnpmStoreOptions = 'local' | 'global';
1422
+
1423
+ /**
1424
+ * @beta
1425
+ */
1426
+ export declare class ProjectChangeAnalyzer {
1427
+ /**
1428
+ * UNINITIALIZED === we haven't looked
1429
+ * undefined === data isn't available (i.e. - git isn't present)
1430
+ */
1431
+ private _data;
1432
+ private _filteredData;
1433
+ private _projectStateCache;
1434
+ private _rushConfiguration;
1435
+ private readonly _git;
1436
+ constructor(rushConfiguration: RushConfiguration);
1437
+ /**
1438
+ * Try to get a list of the specified project's dependencies and their hashes.
1439
+ *
1440
+ * @remarks
1441
+ * If the data can't be generated (i.e. - if Git is not present) this returns undefined.
1442
+ *
1443
+ * @internal
1444
+ */
1445
+ _tryGetProjectDependenciesAsync(project: RushConfigurationProject, terminal: ITerminal): Promise<Map<string, string> | undefined>;
1446
+ /**
1447
+ * The project state hash is calculated in the following way:
1448
+ * - Project dependencies are collected (see ProjectChangeAnalyzer.getPackageDeps)
1449
+ * - If project dependencies cannot be collected (i.e. - if Git isn't available),
1450
+ * this function returns `undefined`
1451
+ * - The (path separator normalized) repo-root-relative dependencies' file paths are sorted
1452
+ * - A SHA1 hash is created and each (sorted) file path is fed into the hash and then its
1453
+ * Git SHA is fed into the hash
1454
+ * - A hex digest of the hash is returned
1455
+ *
1456
+ * @internal
1457
+ */
1458
+ _tryGetProjectStateHashAsync(project: RushConfigurationProject, terminal: ITerminal): Promise<string | undefined>;
1459
+ _filterProjectDataAsync<T>(project: RushConfigurationProject, unfilteredProjectData: Map<string, T>, rootDir: string, terminal: ITerminal): Promise<Map<string, T>>;
1460
+ /**
1461
+ * Gets a list of projects that have changed in the current state of the repo
1462
+ * when compared to the specified branch.
1463
+ */
1464
+ getProjectsWithChangesAsync(options: IGetChangedProjectsOptions): Promise<Set<RushConfigurationProject>>;
1465
+ /**
1466
+ * Gets a list of projects that have changed in the current state of the repo
1467
+ * when compared to the specified branch, taking the shrinkwrap and settings in
1468
+ * the rush-project.json file into consideration.
1469
+ */
1470
+ getProjectsImpactedByDiffAsync(options: IGetChangedProjectsOptions): Promise<Set<RushConfigurationProject>>;
1471
+ private _getChangedProjectsInternalAsync;
1472
+ private _getData;
1473
+ private _getIgnoreMatcherForProjectAsync;
1474
+ private _getRepoDeps;
1475
+ }
1476
+
1477
+ /**
1478
+ * This file is used to track the state of various Rush-related features. It is generated
1479
+ * and updated by Rush.
1480
+ *
1481
+ * @public
1482
+ */
1483
+ export declare class RepoStateFile {
1484
+ private static _jsonSchema;
1485
+ private _repoStateFilePath;
1486
+ private _variant;
1487
+ private _pnpmShrinkwrapHash;
1488
+ private _preferredVersionsHash;
1489
+ private _isValid;
1490
+ private _modified;
1491
+ private constructor();
1492
+ /**
1493
+ * Get the absolute file path of the repo-state.json file.
1494
+ */
1495
+ get filePath(): string;
1496
+ /**
1497
+ * The hash of the pnpm shrinkwrap file at the end of the last update.
1498
+ */
1499
+ get pnpmShrinkwrapHash(): string | undefined;
1500
+ /**
1501
+ * The hash of all preferred versions at the end of the last update.
1502
+ */
1503
+ get preferredVersionsHash(): string | undefined;
1504
+ /**
1505
+ * If false, the repo-state.json file is not valid and its values cannot be relied upon
1506
+ */
1507
+ get isValid(): boolean;
1508
+ /**
1509
+ * Loads the repo-state.json data from the specified file path.
1510
+ * If the file has not been created yet, then an empty object is returned.
1511
+ *
1512
+ * @param jsonFilename - The path to the repo-state.json file.
1513
+ * @param variant - The variant currently being used by Rush.
1514
+ */
1515
+ static loadFromFile(jsonFilename: string, variant: string | undefined): RepoStateFile;
1516
+ /**
1517
+ * Refresh the data contained in repo-state.json using the current state
1518
+ * of the Rush repo, and save the file if changes were made.
1519
+ *
1520
+ * @param rushConfiguration - The Rush configuration for the repo.
1521
+ *
1522
+ * @returns true if the file was modified, otherwise false.
1523
+ */
1524
+ refreshState(rushConfiguration: RushConfiguration): boolean;
1525
+ /**
1526
+ * Writes the "repo-state.json" file to disk, using the filename that was passed to loadFromFile().
1527
+ */
1528
+ private _saveIfModified;
1529
+ private _serialize;
1530
+ }
1531
+
1532
+ /**
1533
+ * General operations for the Rush engine.
1534
+ *
1535
+ * @public
1536
+ */
1537
+ export declare class Rush {
1538
+ private static _version;
1539
+ /**
1540
+ * This API is used by the `@microsoft/rush` front end to launch the "rush" command-line.
1541
+ * Third-party tools should not use this API. Instead, they should execute the "rush" binary
1542
+ * and start a new Node.js process.
1543
+ *
1544
+ * @param launcherVersion - The version of the `@microsoft/rush` wrapper used to call invoke the CLI.
1545
+ *
1546
+ * @remarks
1547
+ * Earlier versions of the rush frontend used a different API contract. In the old contract,
1548
+ * the second argument was the `isManaged` value of the {@link ILaunchOptions} object.
1549
+ *
1550
+ * Even though this API isn't documented, it is still supported for legacy compatibility.
1551
+ */
1552
+ static launch(launcherVersion: string, arg: ILaunchOptions): void;
1553
+ /**
1554
+ * This API is used by the `@microsoft/rush` front end to launch the "rushx" command-line.
1555
+ * Third-party tools should not use this API. Instead, they should execute the "rushx" binary
1556
+ * and start a new Node.js process.
1557
+ *
1558
+ * @param launcherVersion - The version of the `@microsoft/rush` wrapper used to call invoke the CLI.
1559
+ */
1560
+ static launchRushX(launcherVersion: string, options: ILaunchOptions): void;
1561
+ /**
1562
+ * The currently executing version of the "rush-lib" library.
1563
+ * This is the same as the Rush tool version for that release.
1564
+ */
1565
+ static get version(): string;
1566
+ /**
1567
+ * Assign the `RUSH_INVOKED_FOLDER` environment variable during startup. This is only applied when
1568
+ * Rush is invoked via the CLI, not via the `@microsoft/rush-lib` automation API.
1569
+ *
1570
+ * @remarks
1571
+ * Modifying the parent process's environment is not a good design. The better design is (1) to consolidate
1572
+ * Rush's code paths that invoke scripts, and (2) to pass down the invoked folder with each code path,
1573
+ * so that it can finally be applied in a centralized helper like `Utilities._createEnvironmentForRushCommand()`.
1574
+ * The natural time to do that refactoring is when we rework `Utilities.executeCommand()` to use
1575
+ * `Executable.spawn()` or rushell.
1576
+ */
1577
+ private static _assignRushInvokedFolder;
1578
+ /**
1579
+ * This function normalizes legacy options to the current {@link ILaunchOptions} object.
1580
+ */
1581
+ private static _normalizeLaunchOptions;
1582
+ }
1583
+
1584
+ /**
1585
+ * This represents the Rush configuration for a repository, based on the "rush.json"
1586
+ * configuration file.
1587
+ * @public
1588
+ */
1589
+ export declare class RushConfiguration {
1590
+ private static _jsonSchema;
1591
+ private _rushJsonFile;
1592
+ private _rushJsonFolder;
1593
+ private _changesFolder;
1594
+ private _commonFolder;
1595
+ private _commonTempFolder;
1596
+ private _commonScriptsFolder;
1597
+ private _commonRushConfigFolder;
1598
+ private _packageManager;
1599
+ private _packageManagerWrapper;
1600
+ private _npmCacheFolder;
1601
+ private _npmTmpFolder;
1602
+ private _yarnCacheFolder;
1603
+ private _shrinkwrapFilename;
1604
+ private _tempShrinkwrapFilename;
1605
+ private _tempShrinkwrapPreinstallFilename;
1606
+ private _currentVariantJsonFilename;
1607
+ private _packageManagerToolVersion;
1608
+ private _packageManagerToolFilename;
1609
+ private _projectFolderMinDepth;
1610
+ private _projectFolderMaxDepth;
1611
+ private _allowMostlyStandardPackageNames;
1612
+ private _ensureConsistentVersions;
1613
+ private _suppressNodeLtsWarning;
1614
+ private _variants;
1615
+ private readonly _pathTrees;
1616
+ private _approvedPackagesPolicy;
1617
+ private _gitAllowedEmailRegExps;
1618
+ private _gitSampleEmail;
1619
+ private _gitVersionBumpCommitMessage;
1620
+ private _gitChangeLogUpdateCommitMessage;
1621
+ private _gitTagSeparator;
1622
+ private _hotfixChangeEnabled;
1623
+ private _repositoryUrl;
1624
+ private _repositoryDefaultBranch;
1625
+ private _repositoryDefaultRemote;
1626
+ private _npmOptions;
1627
+ private _pnpmOptions;
1628
+ private _yarnOptions;
1629
+ private _packageManagerConfigurationOptions;
1630
+ private _eventHooks;
1631
+ private readonly _packageNameParser;
1632
+ private _telemetryEnabled;
1633
+ private _projects;
1634
+ private _projectsByName;
1635
+ private _commonVersionsConfigurations;
1636
+ private _implicitlyPreferredVersions;
1637
+ private _versionPolicyConfiguration;
1638
+ private _versionPolicyConfigurationFilePath;
1639
+ private _experimentsConfiguration;
1640
+ private __rushPluginsConfiguration;
1641
+ private readonly _rushConfigurationJson;
1642
+ /**
1643
+ * Use RushConfiguration.loadFromConfigurationFile() or Use RushConfiguration.loadFromDefaultLocation()
1644
+ * instead.
1645
+ */
1646
+ private constructor();
1647
+ private _initializeAndValidateLocalProjects;
1648
+ /**
1649
+ * Loads the configuration data from an Rush.json configuration file and returns
1650
+ * an RushConfiguration object.
1651
+ */
1652
+ static loadFromConfigurationFile(rushJsonFilename: string): RushConfiguration;
1653
+ static loadFromDefaultLocation(options?: ITryFindRushJsonLocationOptions): RushConfiguration;
1654
+ /**
1655
+ * Find the rush.json location and return the path, or undefined if a rush.json can't be found.
1656
+ */
1657
+ static tryFindRushJsonLocation(options?: ITryFindRushJsonLocationOptions): string | undefined;
1658
+ /**
1659
+ * This generates the unique names that are used to create temporary projects
1660
+ * in the Rush common folder.
1661
+ * NOTE: sortedProjectJsons is sorted by the caller.
1662
+ */
1663
+ private static _generateTempNamesForProjects;
1664
+ /**
1665
+ * If someone adds a config file in the "common/rush/config" folder, it would be a bad
1666
+ * experience for Rush to silently ignore their file simply because they misspelled the
1667
+ * filename, or maybe it's an old format that's no longer supported. The
1668
+ * _validateCommonRushConfigFolder() function makes sure that this folder only contains
1669
+ * recognized config files.
1670
+ */
1671
+ private static _validateCommonRushConfigFolder;
1672
+ /**
1673
+ * The name of the package manager being used to install dependencies
1674
+ */
1675
+ get packageManager(): PackageManagerName;
1676
+ /**
1677
+ * {@inheritdoc PackageManager}
1678
+ *
1679
+ * @privateremarks
1680
+ * In the next major breaking API change, we will rename this property to "packageManager" and eliminate the
1681
+ * old property with that name.
1682
+ *
1683
+ * @beta
1684
+ */
1685
+ get packageManagerWrapper(): PackageManager;
1686
+ /**
1687
+ * Gets the JSON data structure for the "rush.json" configuration file.
1688
+ *
1689
+ * @internal
1690
+ */
1691
+ get rushConfigurationJson(): IRushConfigurationJson;
1692
+ /**
1693
+ * The absolute path to the "rush.json" configuration file that was loaded to construct this object.
1694
+ */
1695
+ get rushJsonFile(): string;
1696
+ /**
1697
+ * The absolute path of the folder that contains rush.json for this project.
1698
+ */
1699
+ get rushJsonFolder(): string;
1700
+ /**
1701
+ * The folder that contains all change files.
1702
+ */
1703
+ get changesFolder(): string;
1704
+ /**
1705
+ * The fully resolved path for the "common" folder where Rush will store settings that
1706
+ * affect all Rush projects. This is always a subfolder of the folder containing "rush.json".
1707
+ * Example: `C:\MyRepo\common`
1708
+ */
1709
+ get commonFolder(): string;
1710
+ /**
1711
+ * The folder where Rush's additional config files are stored. This folder is always a
1712
+ * subfolder called `config\rush` inside the common folder. (The `common\config` folder
1713
+ * is reserved for configuration files used by other tools.) To avoid confusion or mistakes,
1714
+ * Rush will report an error if this this folder contains any unrecognized files.
1715
+ *
1716
+ * Example: `C:\MyRepo\common\config\rush`
1717
+ */
1718
+ get commonRushConfigFolder(): string;
1719
+ /**
1720
+ * The folder where temporary files will be stored. This is always a subfolder called "temp"
1721
+ * under the common folder.
1722
+ * Example: `C:\MyRepo\common\temp`
1723
+ */
1724
+ get commonTempFolder(): string;
1725
+ /**
1726
+ * The folder where automation scripts are stored. This is always a subfolder called "scripts"
1727
+ * under the common folder.
1728
+ * Example: `C:\MyRepo\common\scripts`
1729
+ */
1730
+ get commonScriptsFolder(): string;
1731
+ /**
1732
+ * The fully resolved path for the "autoinstallers" folder.
1733
+ * Example: `C:\MyRepo\common\autoinstallers`
1734
+ */
1735
+ get commonAutoinstallersFolder(): string;
1736
+ /**
1737
+ * The folder where rush-plugin options json files are stored.
1738
+ * Example: `C:\MyRepo\common\config\rush-plugins`
1739
+ */
1740
+ get rushPluginOptionsFolder(): string;
1741
+ /**
1742
+ * The local folder that will store the NPM package cache. Rush does not rely on the
1743
+ * npm's default global cache folder, because npm's caching implementation does not
1744
+ * reliably handle multiple processes. (For example, if a build box is running
1745
+ * "rush install" simultaneously for two different working folders, it may fail randomly.)
1746
+ *
1747
+ * Example: `C:\MyRepo\common\temp\npm-cache`
1748
+ */
1749
+ get npmCacheFolder(): string;
1750
+ /**
1751
+ * The local folder where npm's temporary files will be written during installation.
1752
+ * Rush does not rely on the global default folder, because it may be on a different
1753
+ * hard disk.
1754
+ *
1755
+ * Example: `C:\MyRepo\common\temp\npm-tmp`
1756
+ */
1757
+ get npmTmpFolder(): string;
1758
+ /**
1759
+ * The local folder that will store the Yarn package cache.
1760
+ *
1761
+ * Example: `C:\MyRepo\common\temp\yarn-cache`
1762
+ */
1763
+ get yarnCacheFolder(): string;
1764
+ /**
1765
+ * The full path of the shrinkwrap file that is tracked by Git. (The "rush install"
1766
+ * command uses a temporary copy, whose path is tempShrinkwrapFilename.)
1767
+ * @remarks
1768
+ * This property merely reports the filename; the file itself may not actually exist.
1769
+ * Example: `C:\MyRepo\common\npm-shrinkwrap.json` or `C:\MyRepo\common\pnpm-lock.yaml`
1770
+ *
1771
+ * @deprecated Use `getCommittedShrinkwrapFilename` instead, which gets the correct common
1772
+ * shrinkwrap file name for a given active variant.
1773
+ */
1774
+ get committedShrinkwrapFilename(): string;
1775
+ /**
1776
+ * The filename (without any path) of the shrinkwrap file that is used by the package manager.
1777
+ * @remarks
1778
+ * This property merely reports the filename; the file itself may not actually exist.
1779
+ * Example: `npm-shrinkwrap.json` or `pnpm-lock.yaml`
1780
+ */
1781
+ get shrinkwrapFilename(): string;
1782
+ /**
1783
+ * The full path of the temporary shrinkwrap file that is used during "rush install".
1784
+ * This file may get rewritten by the package manager during installation.
1785
+ * @remarks
1786
+ * This property merely reports the filename; the file itself may not actually exist.
1787
+ * Example: `C:\MyRepo\common\temp\npm-shrinkwrap.json` or `C:\MyRepo\common\temp\pnpm-lock.yaml`
1788
+ */
1789
+ get tempShrinkwrapFilename(): string;
1790
+ /**
1791
+ * The full path of a backup copy of tempShrinkwrapFilename. This backup copy is made
1792
+ * before installation begins, and can be compared to determine how the package manager
1793
+ * modified tempShrinkwrapFilename.
1794
+ * @remarks
1795
+ * This property merely reports the filename; the file itself may not actually exist.
1796
+ * Example: `C:\MyRepo\common\temp\npm-shrinkwrap-preinstall.json`
1797
+ * or `C:\MyRepo\common\temp\pnpm-lock-preinstall.yaml`
1798
+ */
1799
+ get tempShrinkwrapPreinstallFilename(): string;
1800
+ /**
1801
+ * Returns an English phrase such as "shrinkwrap file" that can be used in logging messages
1802
+ * to refer to the shrinkwrap file using appropriate terminology for the currently selected
1803
+ * package manager.
1804
+ */
1805
+ get shrinkwrapFilePhrase(): string;
1806
+ /**
1807
+ * The filename of the build dependency data file. By default this is
1808
+ * called 'rush-link.json' resides in the Rush common folder.
1809
+ * Its data structure is defined by IRushLinkJson.
1810
+ *
1811
+ * Example: `C:\MyRepo\common\temp\rush-link.json`
1812
+ *
1813
+ * @deprecated The "rush-link.json" file was removed in Rush 5.30.0.
1814
+ * Use `RushConfigurationProject.localDependencyProjects` instead.
1815
+ */
1816
+ get rushLinkJsonFilename(): string;
1817
+ /**
1818
+ * The filename of the variant dependency data file. By default this is
1819
+ * called 'current-variant.json' resides in the Rush common folder.
1820
+ * Its data structure is defined by ICurrentVariantJson.
1821
+ *
1822
+ * Example: `C:\MyRepo\common\temp\current-variant.json`
1823
+ */
1824
+ get currentVariantJsonFilename(): string;
1825
+ /**
1826
+ * The version of the locally installed NPM tool. (Example: "1.2.3")
1827
+ */
1828
+ get packageManagerToolVersion(): string;
1829
+ /**
1830
+ * The absolute path to the locally installed NPM tool. If "rush install" has not
1831
+ * been run, then this file may not exist yet.
1832
+ * Example: `C:\MyRepo\common\temp\npm-local\node_modules\.bin\npm`
1833
+ */
1834
+ get packageManagerToolFilename(): string;
1835
+ /**
1836
+ * The minimum allowable folder depth for the projectFolder field in the rush.json file.
1837
+ * This setting provides a way for repository maintainers to discourage nesting of project folders
1838
+ * that makes the directory tree more difficult to navigate. The default value is 2,
1839
+ * which implements a standard 2-level hierarchy of <categoryFolder>/<projectFolder>/package.json.
1840
+ */
1841
+ get projectFolderMinDepth(): number;
1842
+ /**
1843
+ * The maximum allowable folder depth for the projectFolder field in the rush.json file.
1844
+ * This setting provides a way for repository maintainers to discourage nesting of project folders
1845
+ * that makes the directory tree more difficult to navigate. The default value is 2,
1846
+ * which implements on a standard convention of <categoryFolder>/<projectFolder>/package.json.
1847
+ */
1848
+ get projectFolderMaxDepth(): number;
1849
+ /**
1850
+ * Today the npmjs.com registry enforces fairly strict naming rules for packages, but in the early
1851
+ * days there was no standard and hardly any enforcement. A few large legacy projects are still using
1852
+ * nonstandard package names, and private registries sometimes allow it. Set "allowMostlyStandardPackageNames"
1853
+ * to true to relax Rush's enforcement of package names. This allows upper case letters and in the future may
1854
+ * relax other rules, however we want to minimize these exceptions. Many popular tools use certain punctuation
1855
+ * characters as delimiters, based on the assumption that they will never appear in a package name; thus if we relax
1856
+ * the rules too much it is likely to cause very confusing malfunctions.
1857
+ *
1858
+ * The default value is false.
1859
+ */
1860
+ get allowMostlyStandardPackageNames(): boolean;
1861
+ /**
1862
+ * The "approvedPackagesPolicy" settings.
1863
+ */
1864
+ get approvedPackagesPolicy(): ApprovedPackagesPolicy;
1865
+ /**
1866
+ * [Part of the "gitPolicy" feature.]
1867
+ * A list of regular expressions describing allowable email patterns for Git commits.
1868
+ * They are case-insensitive anchored JavaScript RegExps.
1869
+ * Example: `".*@example\.com"`
1870
+ * This array will never be undefined.
1871
+ */
1872
+ get gitAllowedEmailRegExps(): string[];
1873
+ /**
1874
+ * [Part of the "gitPolicy" feature.]
1875
+ * An example valid email address that conforms to one of the allowedEmailRegExps.
1876
+ * Example: `"foxtrot@example\.com"`
1877
+ * This will never be undefined, and will always be nonempty if gitAllowedEmailRegExps is used.
1878
+ */
1879
+ get gitSampleEmail(): string;
1880
+ /**
1881
+ * [Part of the "gitPolicy" feature.]
1882
+ * The commit message to use when committing changes during 'rush publish'
1883
+ */
1884
+ get gitVersionBumpCommitMessage(): string | undefined;
1885
+ /**
1886
+ * [Part of the "gitPolicy" feature.]
1887
+ * The commit message to use when committing change log files 'rush version'
1888
+ */
1889
+ get gitChangeLogUpdateCommitMessage(): string | undefined;
1890
+ /**
1891
+ * [Part of the "gitPolicy" feature.]
1892
+ * The separator between package name and version in git tag.
1893
+ */
1894
+ get gitTagSeparator(): string | undefined;
1895
+ /**
1896
+ * [Part of the "hotfixChange" feature.]
1897
+ * Enables creating hotfix changes
1898
+ */
1899
+ get hotfixChangeEnabled(): boolean;
1900
+ /**
1901
+ * The remote url of the repository. This helps "rush change" find the right remote to compare against.
1902
+ */
1903
+ get repositoryUrl(): string | undefined;
1904
+ /**
1905
+ * The default branch name. This tells "rush change" which remote branch to compare against.
1906
+ */
1907
+ get repositoryDefaultBranch(): string;
1908
+ /**
1909
+ * The default remote. This tells "rush change" which remote to compare against if the remote URL is not set
1910
+ * or if a remote matching the provided remote URL is not found.
1911
+ */
1912
+ get repositoryDefaultRemote(): string;
1913
+ /**
1914
+ * The default fully-qualified git remote branch of the repository. This helps "rush change" find the right branch to compare against.
1915
+ */
1916
+ get repositoryDefaultFullyQualifiedRemoteBranch(): string;
1917
+ /**
1918
+ * Odd-numbered major versions of Node.js are experimental. Even-numbered releases
1919
+ * spend six months in a stabilization period before the first Long Term Support (LTS) version.
1920
+ * For example, 8.9.0 was the first LTS version of Node.js 8. Pre-LTS versions are not recommended
1921
+ * for production usage because they frequently have bugs. They may cause Rush itself
1922
+ * to malfunction.
1923
+ *
1924
+ * Rush normally prints a warning if it detects a pre-LTS Node.js version. If you are testing
1925
+ * pre-LTS versions in preparation for supporting the first LTS version, you can use this setting
1926
+ * to disable Rush's warning.
1927
+ */
1928
+ get suppressNodeLtsWarning(): boolean;
1929
+ /**
1930
+ * If true, then consistent version specifiers for dependencies will be enforced.
1931
+ * I.e. "rush check" is run before some commands.
1932
+ */
1933
+ get ensureConsistentVersions(): boolean;
1934
+ /**
1935
+ * Indicates whether telemetry collection is enabled for Rush runs.
1936
+ * @beta
1937
+ */
1938
+ get telemetryEnabled(): boolean;
1939
+ get projects(): RushConfigurationProject[];
1940
+ get projectsByName(): Map<string, RushConfigurationProject>;
1941
+ /**
1942
+ * {@inheritDoc NpmOptionsConfiguration}
1943
+ */
1944
+ get npmOptions(): NpmOptionsConfiguration;
1945
+ /**
1946
+ * {@inheritDoc PnpmOptionsConfiguration}
1947
+ */
1948
+ get pnpmOptions(): PnpmOptionsConfiguration;
1949
+ /**
1950
+ * {@inheritDoc YarnOptionsConfiguration}
1951
+ */
1952
+ get yarnOptions(): YarnOptionsConfiguration;
1953
+ /**
1954
+ * The configuration options used by the current package manager.
1955
+ * @remarks
1956
+ * For package manager specific variants, reference {@link RushConfiguration.npmOptions | npmOptions},
1957
+ * {@link RushConfiguration.pnpmOptions | pnpmOptions}, or {@link RushConfiguration.yarnOptions | yarnOptions}.
1958
+ */
1959
+ get packageManagerOptions(): PackageManagerOptionsConfigurationBase;
1960
+ /**
1961
+ * Settings from the common-versions.json config file.
1962
+ * @remarks
1963
+ * If the common-versions.json file is missing, this property will not be undefined.
1964
+ * Instead it will be initialized in an empty state, and calling CommonVersionsConfiguration.save()
1965
+ * will create the file.
1966
+ *
1967
+ * @deprecated Use `getCommonVersions` instead, which gets the correct common version data
1968
+ * for a given active variant.
1969
+ */
1970
+ get commonVersions(): CommonVersionsConfiguration;
1971
+ /**
1972
+ * Gets the currently-installed variant, if an installation has occurred.
1973
+ * For Rush operations which do not take a --variant parameter, this method
1974
+ * determines which variant, if any, was last specified when performing "rush install"
1975
+ * or "rush update".
1976
+ */
1977
+ get currentInstalledVariant(): string | undefined;
1978
+ /**
1979
+ * The rush hooks. It allows customized scripts to run at the specified point.
1980
+ * @beta
1981
+ */
1982
+ get eventHooks(): EventHooks;
1983
+ /**
1984
+ * The rush hooks. It allows customized scripts to run at the specified point.
1985
+ */
1986
+ get packageNameParser(): PackageNameParser;
1987
+ /**
1988
+ * Gets the path to the common-versions.json config file for a specific variant.
1989
+ * @param variant - The name of the current variant in use by the active command.
1990
+ */
1991
+ getCommonVersionsFilePath(variant?: string | undefined): string;
1992
+ /**
1993
+ * Gets the settings from the common-versions.json config file for a specific variant.
1994
+ * @param variant - The name of the current variant in use by the active command.
1995
+ */
1996
+ getCommonVersions(variant?: string | undefined): CommonVersionsConfiguration;
1997
+ /**
1998
+ * Returns a map of all direct dependencies that only have a single semantic version specifier.
1999
+ * @param variant - The name of the current variant in use by the active command.
2000
+ *
2001
+ * @returns A map of dependency name --\> version specifier for implicitly preferred versions.
2002
+ */
2003
+ getImplicitlyPreferredVersions(variant?: string | undefined): Map<string, string>;
2004
+ /**
2005
+ * Gets the path to the repo-state.json file for a specific variant.
2006
+ * @param variant - The name of the current variant in use by the active command.
2007
+ */
2008
+ getRepoStateFilePath(variant?: string | undefined): string;
2009
+ /**
2010
+ * Gets the contents from the repo-state.json file for a specific variant.
2011
+ * @param variant - The name of the current variant in use by the active command.
2012
+ */
2013
+ getRepoState(variant?: string | undefined): RepoStateFile;
2014
+ /**
2015
+ * Gets the committed shrinkwrap file name for a specific variant.
2016
+ * @param variant - The name of the current variant in use by the active command.
2017
+ */
2018
+ getCommittedShrinkwrapFilename(variant?: string | undefined): string;
2019
+ /**
2020
+ * Gets the absolute path for "pnpmfile.js" for a specific variant.
2021
+ * @param variant - The name of the current variant in use by the active command.
2022
+ * @remarks
2023
+ * The file path is returned even if PNPM is not configured as the package manager.
2024
+ */
2025
+ getPnpmfilePath(variant?: string | undefined): string;
2026
+ /**
2027
+ * Looks up a project in the projectsByName map. If the project is not found,
2028
+ * then undefined is returned.
2029
+ */
2030
+ getProjectByName(projectName: string): RushConfigurationProject | undefined;
2031
+ /**
2032
+ * This is used e.g. by command-line interfaces such as "rush build --to example".
2033
+ * If "example" is not a project name, then it also looks for a scoped name
2034
+ * like `@something/example`. If exactly one project matches this heuristic, it
2035
+ * is returned. Otherwise, undefined is returned.
2036
+ */
2037
+ findProjectByShorthandName(shorthandProjectName: string): RushConfigurationProject | undefined;
2038
+ /**
2039
+ * Looks up a project by its RushConfigurationProject.tempProjectName field.
2040
+ * @returns The found project, or undefined if no match was found.
2041
+ */
2042
+ findProjectByTempName(tempProjectName: string): RushConfigurationProject | undefined;
2043
+ /**
2044
+ * @returns An optimized lookup engine to find a project by its path relative to the specified root.
2045
+ * @beta
2046
+ */
2047
+ getProjectLookupForRoot(rootPath: string): LookupByPath<RushConfigurationProject>;
2048
+ /**
2049
+ * @beta
2050
+ */
2051
+ get versionPolicyConfiguration(): VersionPolicyConfiguration;
2052
+ /**
2053
+ * @beta
2054
+ */
2055
+ get versionPolicyConfigurationFilePath(): string;
2056
+ /**
2057
+ * This configuration object contains settings repo maintainers have specified to enable
2058
+ * and disable experimental Rush features.
2059
+ *
2060
+ * @beta
2061
+ */
2062
+ get experimentsConfiguration(): ExperimentsConfiguration;
2063
+ /**
2064
+ * @internal
2065
+ */
2066
+ get _rushPluginsConfiguration(): RushPluginsConfiguration;
2067
+ /**
2068
+ * Returns the project for which the specified path is underneath that project's folder.
2069
+ * If the path is not under any project's folder, returns undefined.
2070
+ */
2071
+ tryGetProjectForPath(currentFolderPath: string): RushConfigurationProject | undefined;
2072
+ private _collectVersionsForDependencies;
2073
+ private _populateDownstreamDependencies;
2074
+ private _getVariantConfigFolderPath;
2075
+ }
2076
+
2077
+ /**
2078
+ * This represents the configuration of a project that is built by Rush, based on
2079
+ * the Rush.json configuration file.
2080
+ * @public
2081
+ */
2082
+ export declare class RushConfigurationProject {
2083
+ private _packageName;
2084
+ private _projectFolder;
2085
+ private _projectRelativeFolder;
2086
+ private _projectRushConfigFolder;
2087
+ private _projectRushTempFolder;
2088
+ private _reviewCategory;
2089
+ private _packageJson;
2090
+ private _packageJsonEditor;
2091
+ private _tempProjectName;
2092
+ private _unscopedTempProjectName;
2093
+ private _cyclicDependencyProjects;
2094
+ private _versionPolicyName;
2095
+ private _versionPolicy;
2096
+ private _shouldPublish;
2097
+ private _skipRushCheck;
2098
+ private _publishFolder;
2099
+ private _dependencyProjects;
2100
+ private _consumingProjects;
2101
+ private readonly _rushConfiguration;
2102
+ /**
2103
+ * A set of projects within the Rush configuration which directly consume this package.
2104
+ *
2105
+ * @remarks
2106
+ * Writable because it is mutated by RushConfiguration during initialization.
2107
+ * @internal
2108
+ */
2109
+ readonly _consumingProjectNames: Set<string>;
2110
+ /** @internal */
2111
+ constructor(projectJson: IRushConfigurationProjectJson, rushConfiguration: RushConfiguration, tempProjectName: string);
2112
+ /**
2113
+ * The name of the NPM package. An error is reported if this name is not
2114
+ * identical to packageJson.name.
2115
+ *
2116
+ * Example: `@scope/MyProject`
2117
+ */
2118
+ get packageName(): string;
2119
+ /**
2120
+ * The full path of the folder that contains the project to be built by Rush.
2121
+ *
2122
+ * Example: `C:\MyRepo\libraries\my-project`
2123
+ */
2124
+ get projectFolder(): string;
2125
+ /**
2126
+ * The relative path of the folder that contains the project to be built by Rush.
2127
+ *
2128
+ * Example: `libraries/my-project`
2129
+ */
2130
+ get projectRelativeFolder(): string;
2131
+ /**
2132
+ * The project-specific Rush configuration folder.
2133
+ *
2134
+ * Example: `C:\MyRepo\libraries\my-project\config\rush`
2135
+ */
2136
+ get projectRushConfigFolder(): string;
2137
+ /**
2138
+ * The project-specific Rush temp folder. This folder is used to store Rush-specific temporary files.
2139
+ *
2140
+ * Example: `C:\MyRepo\libraries\my-project\.rush\temp`
2141
+ */
2142
+ get projectRushTempFolder(): string;
2143
+ /**
2144
+ * The Rush configuration for the monorepo that the project belongs to.
2145
+ */
2146
+ get rushConfiguration(): RushConfiguration;
2147
+ /**
2148
+ * The review category name, or undefined if no category was assigned.
2149
+ * This name must be one of the valid choices listed in RushConfiguration.reviewCategories.
2150
+ */
2151
+ get reviewCategory(): string | undefined;
2152
+ /**
2153
+ * A list of local projects that appear as devDependencies for this project, but cannot be
2154
+ * locally linked because it would create a cyclic dependency; instead, the last published
2155
+ * version will be installed in the Common folder.
2156
+ *
2157
+ * These are package names that would be found by RushConfiguration.getProjectByName().
2158
+ */
2159
+ get cyclicDependencyProjects(): Set<string>;
2160
+ /**
2161
+ * An array of projects within the Rush configuration which directly depend on this package.
2162
+ * @deprecated Use `consumingProjectNames` instead, as it has Set semantics, which better reflect the nature
2163
+ * of the data.
2164
+ */
2165
+ get downstreamDependencyProjects(): string[];
2166
+ /**
2167
+ * An array of projects within the Rush configuration which this project declares as dependencies.
2168
+ * @deprecated Use `dependencyProjects` instead, as it has Set semantics, which better reflect the nature
2169
+ * of the data.
2170
+ */
2171
+ get localDependencyProjects(): ReadonlyArray<RushConfigurationProject>;
2172
+ /**
2173
+ * The set of projects within the Rush configuration which this project declares as dependencies.
2174
+ *
2175
+ * @remarks
2176
+ * Can be used recursively to walk the project dependency graph to find all projects that are directly or indirectly
2177
+ * referenced from this project.
2178
+ */
2179
+ get dependencyProjects(): ReadonlySet<RushConfigurationProject>;
2180
+ /**
2181
+ * The set of projects within the Rush configuration which declare this project as a dependency.
2182
+ * Excludes those that declare this project as a `cyclicDependencyProject`.
2183
+ *
2184
+ * @remarks
2185
+ * This field is the counterpart to `dependencyProjects`, and can be used recursively to walk the project dependency
2186
+ * graph to find all projects which will be impacted by changes to this project.
2187
+ */
2188
+ get consumingProjects(): ReadonlySet<RushConfigurationProject>;
2189
+ /**
2190
+ * The parsed NPM "package.json" file from projectFolder.
2191
+ * @deprecated Use packageJsonEditor instead
2192
+ */
2193
+ get packageJson(): IPackageJson;
2194
+ /**
2195
+ * A useful wrapper around the package.json file for making modifications
2196
+ * @beta
2197
+ */
2198
+ get packageJsonEditor(): PackageJsonEditor;
2199
+ /**
2200
+ * The unique name for the temporary project that will be generated in the Common folder.
2201
+ * For example, if the project name is `@scope/MyProject`, the temporary project name
2202
+ * might be `@rush-temp/MyProject-2`.
2203
+ *
2204
+ * Example: `@rush-temp/MyProject-2`
2205
+ */
2206
+ get tempProjectName(): string;
2207
+ /**
2208
+ * The unscoped temporary project name
2209
+ *
2210
+ * Example: `my-project-2`
2211
+ */
2212
+ get unscopedTempProjectName(): string;
2213
+ /**
2214
+ * A flag which indicates whether changes to this project should be published. This controls
2215
+ * whether or not the project would show up when running `rush change`, and whether or not it
2216
+ * should be published during `rush publish`.
2217
+ */
2218
+ get shouldPublish(): boolean;
2219
+ /**
2220
+ * If true, then this project will be ignored by the "rush check" command.
2221
+ * The default value is false.
2222
+ */
2223
+ get skipRushCheck(): boolean;
2224
+ /**
2225
+ * Name of the version policy used by this project.
2226
+ * @beta
2227
+ */
2228
+ get versionPolicyName(): string | undefined;
2229
+ /**
2230
+ * The full path of the folder that will get published by Rush.
2231
+ *
2232
+ * @remarks
2233
+ * By default this is the same as the project folder, but a custom folder can be specified
2234
+ * using the the "publishFolder" setting in rush.json.
2235
+ *
2236
+ * Example: `C:\MyRepo\libraries\my-project\temp\publish`
2237
+ */
2238
+ get publishFolder(): string;
2239
+ /**
2240
+ * Version policy of the project
2241
+ * @beta
2242
+ */
2243
+ get versionPolicy(): VersionPolicy | undefined;
2244
+ /**
2245
+ * Indicate whether this project is the main project for the related version policy.
2246
+ *
2247
+ * False if the project is not for publishing.
2248
+ * True if the project is individually versioned or if its lockstep version policy does not specify main project.
2249
+ * False if the project is lockstepped and is not the main project for its version policy.
2250
+ *
2251
+ * @beta
2252
+ */
2253
+ get isMainProject(): boolean;
2254
+ /**
2255
+ * Compute the local rush projects that this project immediately depends on,
2256
+ * according to the specific dependency group from package.json
2257
+ */
2258
+ private _getDependencyProjects;
2259
+ /**
2260
+ * Compute the local rush projects that declare this project as a dependency
2261
+ */
2262
+ private _getConsumingProjects;
2263
+ }
2264
+
2265
+ /**
2266
+ * Constants used by the Rush tool.
2267
+ * @beta
2268
+ *
2269
+ * @remarks
2270
+ *
2271
+ * These are NOT part of the public API surface for rush-lib.
2272
+ * The rationale is that we don't want people implementing custom parsers for
2273
+ * the Rush config files; instead, they should rely on the official APIs from rush-lib.
2274
+ */
2275
+ export declare class RushConstants {
2276
+ /**
2277
+ * The filename ("browser-approved-packages.json") for an optional policy configuration file
2278
+ * that stores a list of NPM packages that have been approved for usage by Rush projects.
2279
+ * This is part of a pair of config files, one for projects that run in a web browser
2280
+ * (e.g. whose approval criteria mostly focuses on licensing and code size), and one for everywhere else
2281
+ * (e.g. tooling projects whose approval criteria mostly focuses on avoiding node_modules sprawl).
2282
+ */
2283
+ static readonly browserApprovedPackagesFilename: string;
2284
+ /**
2285
+ * The folder name ("changes") where change files will be stored.
2286
+ */
2287
+ static readonly changeFilesFolderName: string;
2288
+ /**
2289
+ * The filename ("nonbrowser-approved-packages.json") for an optional policy configuration file
2290
+ * that stores a list of NPM packages that have been approved for usage by Rush projects.
2291
+ * This is part of a pair of config files, one for projects that run in a web browser
2292
+ * (e.g. whose approval criteria mostly focuses on licensing and code size), and one for everywhere else
2293
+ * (e.g. tooling projects whose approval criteria mostly focuses on avoiding node_modules sprawl).
2294
+ */
2295
+ static readonly nonbrowserApprovedPackagesFilename: string;
2296
+ /**
2297
+ * The folder name ("common") where Rush's common data will be stored.
2298
+ */
2299
+ static readonly commonFolderName: string;
2300
+ /**
2301
+ * The NPM scope ("\@rush-temp") that is used for Rush's temporary projects.
2302
+ */
2303
+ static readonly rushTempNpmScope: string;
2304
+ /**
2305
+ * The folder name ("temp") under the common folder, or under the .rush folder in each project's directory where
2306
+ * temporary files will be stored.
2307
+ * Example: `C:\MyRepo\common\temp`
2308
+ */
2309
+ static readonly rushTempFolderName: string;
2310
+ /**
2311
+ * The folder name ("projects") where temporary projects will be stored.
2312
+ * Example: `C:\MyRepo\common\temp\projects`
2313
+ */
2314
+ static readonly rushTempProjectsFolderName: string;
2315
+ /**
2316
+ * The folder name ("variants") under which named variant configurations for
2317
+ * alternate dependency sets may be found.
2318
+ * Example: `C:\MyRepo\common\config\rush\variants`
2319
+ */
2320
+ static readonly rushVariantsFolderName: string;
2321
+ /**
2322
+ * The filename ("npm-shrinkwrap.json") used to store an installation plan for the NPM package manger.
2323
+ */
2324
+ static readonly npmShrinkwrapFilename: string;
2325
+ /**
2326
+ * Number of installation attempts
2327
+ */
2328
+ static readonly defaultMaxInstallAttempts: number;
2329
+ /**
2330
+ * The filename ("pnpm-lock.yaml") used to store an installation plan for the PNPM package manger
2331
+ * (PNPM version 3.x and later).
2332
+ */
2333
+ static readonly pnpmV3ShrinkwrapFilename: string;
2334
+ /**
2335
+ * The filename ("pnpmfile.js") used to add custom configuration to PNPM (PNPM version 1.x and later).
2336
+ */
2337
+ static readonly pnpmfileV1Filename: string;
2338
+ /**
2339
+ * The filename (".pnpmfile.cjs") used to add custom configuration to PNPM (PNPM version 6.x and later).
2340
+ */
2341
+ static readonly pnpmfileV6Filename: string;
2342
+ /**
2343
+ * The filename ("shrinkwrap.yaml") used to store state for pnpm
2344
+ */
2345
+ static readonly yarnShrinkwrapFilename: string;
2346
+ /**
2347
+ * The folder name ("node_modules") where NPM installs its packages.
2348
+ */
2349
+ static readonly nodeModulesFolderName: string;
2350
+ /**
2351
+ * The filename ("pinned-versions.json") for an old configuration file that
2352
+ * that is no longer supported.
2353
+ *
2354
+ * @deprecated This feature has been superseded by the "preferredVersions" setting
2355
+ * in common-versions.json
2356
+ */
2357
+ static readonly pinnedVersionsFilename: string;
2358
+ /**
2359
+ * The filename ("common-versions.json") for an optional configuration file
2360
+ * that stores dependency version information that affects all projects in the repo.
2361
+ * This configuration file should go in the "common/config/rush" folder.
2362
+ */
2363
+ static readonly commonVersionsFilename: string;
2364
+ /**
2365
+ * The filename ("repo-state.json") for a file used by Rush to
2366
+ * store the state of various features as they stand in the repo.
2367
+ */
2368
+ static readonly repoStateFilename: string;
2369
+ /**
2370
+ * The name of the per-project folder where project-specific Rush files are stored. For example,
2371
+ * the package-deps files, which are used by commands to determine if a particular project needs to be rebuilt.
2372
+ */
2373
+ static readonly projectRushFolderName: string;
2374
+ /**
2375
+ * Custom command line configuration file, which is used by rush for implementing
2376
+ * custom command and options.
2377
+ */
2378
+ static readonly commandLineFilename: string;
2379
+ static readonly versionPoliciesFilename: string;
2380
+ /**
2381
+ * Experiments configuration file.
2382
+ */
2383
+ static readonly experimentsFilename: string;
2384
+ /**
2385
+ * Rush plugins configuration file name.
2386
+ */
2387
+ static readonly rushPluginsConfigFilename: string;
2388
+ /**
2389
+ * Rush plugin manifest file name.
2390
+ */
2391
+ static readonly rushPluginManifestFilename: string;
2392
+ /**
2393
+ * The artifactory.json configuration file name.
2394
+ */
2395
+ static readonly artifactoryFilename: string;
2396
+ /**
2397
+ * Build cache configuration file.
2398
+ */
2399
+ static readonly buildCacheFilename: string;
2400
+ /**
2401
+ * Per-project configuration filename.
2402
+ */
2403
+ static readonly rushProjectConfigFilename: string;
2404
+ /**
2405
+ * The URL ("http://rushjs.io") for the Rush web site.
2406
+ */
2407
+ static readonly rushWebSiteUrl: string;
2408
+ /**
2409
+ * The name of the NPM package for the Rush tool ("\@microsoft/rush").
2410
+ */
2411
+ static readonly rushPackageName: string;
2412
+ /**
2413
+ * The folder name ("rush-recycler") where Rush moves large folder trees
2414
+ * before asynchronously deleting them.
2415
+ */
2416
+ static readonly rushRecyclerFolderName: string;
2417
+ /**
2418
+ * The name of the file to drop in project-folder/.rush/temp/ containing a listing of the project's direct
2419
+ * and indirect dependencies. This is used to detect if a project's dependencies have changed since the last build.
2420
+ */
2421
+ static readonly projectShrinkwrapFilename: string;
2422
+ /**
2423
+ * The value of the "commandKind" property for a bulk command in command-line.json
2424
+ */
2425
+ static readonly bulkCommandKind: 'bulk';
2426
+ /**
2427
+ * The value of the "commandKind" property for a global command in command-line.json
2428
+ */
2429
+ static readonly globalCommandKind: 'global';
2430
+ /**
2431
+ * The value of the "commandKind" property for a phased command in command-line.json
2432
+ */
2433
+ static readonly phasedCommandKind: 'phased';
2434
+ /**
2435
+ * The name of the incremental build command.
2436
+ */
2437
+ static readonly buildCommandName: string;
2438
+ /**
2439
+ * The name of the non-incremental build command.
2440
+ */
2441
+ static readonly rebuildCommandName: string;
2442
+ static readonly updateCloudCredentialsCommandName: string;
2443
+ /**
2444
+ * When a hash generated that contains multiple input segments, this character may be used
2445
+ * to separate them to avoid issues like
2446
+ * crypto.createHash('sha1').update('a').update('bc').digest('hex') === crypto.createHash('sha1').update('ab').update('c').digest('hex')
2447
+ */
2448
+ static readonly hashDelimiter: string;
2449
+ /**
2450
+ * The name of the per-user Rush configuration data folder.
2451
+ */
2452
+ static readonly rushUserConfigurationFolderName: string;
2453
+ }
2454
+
2455
+ /**
2456
+ * This class provides global folders that are used for rush's internal install locations.
2457
+ *
2458
+ * @internal
2459
+ */
2460
+ export declare class _RushGlobalFolder {
2461
+ private _rushGlobalFolder;
2462
+ private _rushNodeSpecificUserFolder;
2463
+ /**
2464
+ * The global folder where Rush stores temporary files.
2465
+ *
2466
+ * @remarks
2467
+ *
2468
+ * Most of the temporary files created by Rush are stored separately for each monorepo working folder,
2469
+ * to avoid issues of concurrency and compatibility between tool versions. However, a small set
2470
+ * of files (e.g. installations of the `@microsoft/rush-lib` engine and the package manager) are stored
2471
+ * in a global folder to speed up installations. The default location is `~/.rush` on POSIX-like
2472
+ * operating systems or `C:\Users\YourName` on Windows.
2473
+ *
2474
+ * You can use the {@link EnvironmentVariableNames.RUSH_GLOBAL_FOLDER} environment variable to specify
2475
+ * a different folder path. This is useful for example if a Windows group policy forbids executing scripts
2476
+ * installed in a user's home directory.
2477
+ *
2478
+ * POSIX is a registered trademark of the Institute of Electrical and Electronic Engineers, Inc.
2479
+ */
2480
+ get path(): string;
2481
+ /**
2482
+ * The absolute path to Rush's storage in the home directory for the current user and node version.
2483
+ * On Windows, it would be something like `C:\Users\YourName\.rush\node-v3.4.5`.
2484
+ */
2485
+ get nodeSpecificPath(): string;
2486
+ constructor();
2487
+ }
2488
+
2489
+ /**
2490
+ * @beta
2491
+ */
2492
+ export declare class RushLifecycleHooks {
2493
+ /**
2494
+ * The hook to run when all rush plugins is initialized.
2495
+ */
2496
+ initialize: AsyncSeriesHook<void>;
2497
+ }
2498
+
2499
+ declare class RushPluginsConfiguration {
2500
+ private static _jsonSchema;
2501
+ private _rushPluginsConfigurationJson;
2502
+ private _jsonFilename;
2503
+ constructor(jsonFilename: string);
2504
+ get configuration(): Readonly<IRushPluginsConfigurationJson>;
2505
+ }
2506
+
2507
+ /**
2508
+ * @beta
2509
+ */
2510
+ export declare class RushSession {
2511
+ private readonly _options;
2512
+ private readonly _cloudBuildCacheProviderFactories;
2513
+ readonly hooks: RushLifecycleHooks;
2514
+ constructor(options: IRushSessionOptions);
2515
+ getLogger(name: string): ILogger;
2516
+ get terminalProvider(): ITerminalProvider;
2517
+ registerCloudBuildCacheProviderFactory(cacheProviderName: string, factory: CloudBuildCacheProviderFactory): void;
2518
+ getCloudBuildCacheProviderFactory(cacheProviderName: string): CloudBuildCacheProviderFactory | undefined;
2519
+ }
2520
+
2521
+ /**
2522
+ * Rush per-user configuration data.
2523
+ *
2524
+ * @beta
2525
+ */
2526
+ export declare class RushUserConfiguration {
2527
+ private static _schema;
2528
+ /**
2529
+ * If provided, store build cache in the specified folder. Must be an absolute path.
2530
+ */
2531
+ readonly buildCacheFolder: string | undefined;
2532
+ private constructor();
2533
+ static initializeAsync(): Promise<RushUserConfiguration>;
2534
+ static getRushUserFolderPath(): string;
2535
+ }
2536
+
2537
+ declare enum VersionFormatForCommit {
2538
+ wildcard = "wildcard",
2539
+ original = "original"
2540
+ }
2541
+
2542
+ declare enum VersionFormatForPublish {
2543
+ original = "original",
2544
+ exact = "exact"
2545
+ }
2546
+
2547
+ /**
2548
+ * This is the base class for version policy which controls how versions get bumped.
2549
+ * @public
2550
+ */
2551
+ export declare abstract class VersionPolicy {
2552
+ private _policyName;
2553
+ private _definitionName;
2554
+ private _exemptFromRushChange;
2555
+ private _includeEmailInChangeFile;
2556
+ private _versionFormatForCommit;
2557
+ private _versionFormatForPublish;
2558
+ /**
2559
+ * @internal
2560
+ */
2561
+ constructor(versionPolicyJson: IVersionPolicyJson);
2562
+ /**
2563
+ * Loads from version policy json
2564
+ *
2565
+ * @param versionPolicyJson - version policy Json
2566
+ *
2567
+ * @internal
2568
+ */
2569
+ static load(versionPolicyJson: IVersionPolicyJson): VersionPolicy | undefined;
2570
+ /**
2571
+ * Version policy name
2572
+ */
2573
+ get policyName(): string;
2574
+ /**
2575
+ * Version policy definition name
2576
+ */
2577
+ get definitionName(): VersionPolicyDefinitionName;
2578
+ /**
2579
+ * Whether it is a lockstepped version policy
2580
+ */
2581
+ get isLockstepped(): boolean;
2582
+ /**
2583
+ * Determines if a version policy wants to opt out of changelog files.
2584
+ */
2585
+ get exemptFromRushChange(): boolean;
2586
+ /**
2587
+ * Determines if a version policy wants to opt in to including email.
2588
+ */
2589
+ get includeEmailInChangeFile(): boolean;
2590
+ /**
2591
+ * Returns an updated package json that satisfies the policy.
2592
+ *
2593
+ * @param project - package json
2594
+ * @param force - force update even when the project version is higher than the policy version.
2595
+ */
2596
+ abstract ensure(project: IPackageJson, force?: boolean): IPackageJson | undefined;
2597
+ /**
2598
+ * Bumps version based on the policy
2599
+ *
2600
+ * @param bumpType - (optional) override bump type
2601
+ * @param identifier - (optional) override prerelease Id
2602
+ */
2603
+ abstract bump(bumpType?: BumpType, identifier?: string): void;
2604
+ /**
2605
+ * Serialized json for the policy
2606
+ *
2607
+ * @internal
2608
+ */
2609
+ abstract get _json(): IVersionPolicyJson;
2610
+ /**
2611
+ * Validates the specified version and throws if the version does not satisfy the policy.
2612
+ *
2613
+ * @param versionString - version string
2614
+ * @param packageName - package name
2615
+ */
2616
+ abstract validate(versionString: string, packageName: string): void;
2617
+ /**
2618
+ * Tells the version policy to modify any dependencies in the target package
2619
+ * to values used for publishing.
2620
+ */
2621
+ setDependenciesBeforePublish(packageName: string, configuration: RushConfiguration): void;
2622
+ /**
2623
+ * Tells the version policy to modify any dependencies in the target package
2624
+ * to values used for checked-in source.
2625
+ */
2626
+ setDependenciesBeforeCommit(packageName: string, configuration: RushConfiguration): void;
2627
+ }
2628
+
2629
+ /**
2630
+ * Use this class to load and save the "common/config/rush/version-policies.json" config file.
2631
+ * This config file configures how different groups of projects will be published by Rush,
2632
+ * and how their version numbers will be determined.
2633
+ * @public
2634
+ */
2635
+ export declare class VersionPolicyConfiguration {
2636
+ private static _jsonSchema;
2637
+ private _versionPolicies;
2638
+ private _jsonFileName;
2639
+ /**
2640
+ * @internal
2641
+ */
2642
+ constructor(jsonFileName: string);
2643
+ /**
2644
+ * Validate the version policy configuration against the rush config
2645
+ */
2646
+ validate(projectsByName: Map<string, RushConfigurationProject>): void;
2647
+ /**
2648
+ * Gets the version policy by its name.
2649
+ * Throws error if the version policy is not found.
2650
+ * @param policyName - Name of the version policy
2651
+ */
2652
+ getVersionPolicy(policyName: string): VersionPolicy;
2653
+ /**
2654
+ * Gets all the version policies
2655
+ */
2656
+ get versionPolicies(): Map<string, VersionPolicy>;
2657
+ /**
2658
+ * Bumps up versions for the specified version policy or all version policies
2659
+ *
2660
+ * @param versionPolicyName - version policy name
2661
+ * @param bumpType - bump type to override what policy has defined.
2662
+ * @param identifier - prerelease identifier to override what policy has defined.
2663
+ * @param shouldCommit - should save to disk
2664
+ */
2665
+ bump(versionPolicyName?: string, bumpType?: BumpType, identifier?: string, shouldCommit?: boolean): void;
2666
+ /**
2667
+ * Updates the version directly for the specified version policy
2668
+ * @param versionPolicyName - version policy name
2669
+ * @param newVersion - new version
2670
+ */
2671
+ update(versionPolicyName: string, newVersion: string): void;
2672
+ private _loadFile;
2673
+ private _saveFile;
2674
+ }
2675
+
2676
+ /**
2677
+ * Version policy base type names
2678
+ * @public
2679
+ */
2680
+ export declare enum VersionPolicyDefinitionName {
2681
+ 'lockStepVersion' = 0,
2682
+ 'individualVersion' = 1
2683
+ }
2684
+
2685
+ /**
2686
+ * Options that are only used when the yarn package manager is selected.
2687
+ *
2688
+ * @remarks
2689
+ * It is valid to define these options in rush.json even if the yarn package manager
2690
+ * is not being used.
2691
+ *
2692
+ * @public
2693
+ */
2694
+ export declare class YarnOptionsConfiguration extends PackageManagerOptionsConfigurationBase {
2695
+ /**
2696
+ * If true, then Rush will add the "--ignore-engines" option when invoking Yarn.
2697
+ * This allows "rush install" to succeed if there are dependencies with engines defined in
2698
+ * package.json which do not match the current environment.
2699
+ *
2700
+ * The default value is false.
2701
+ */
2702
+ readonly ignoreEngines: boolean;
2703
+ /** @internal */
2704
+ constructor(json: _IYarnOptionsJson);
2705
+ }
2706
+
2707
+ export { }