Skip to content

Commit ea67c74

Browse files
committed
Remove IVariantName export
1 parent e4e5260 commit ea67c74

9 files changed

Lines changed: 25 additions & 48 deletions

File tree

‎apps/rush-lib/src/api/RushConfiguration.ts‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import { VersionPolicyConfiguration } from './VersionPolicyConfiguration';
2121
import { EnvironmentConfiguration } from './EnvironmentConfiguration';
2222
import { CommonVersionsConfiguration } from './CommonVersionsConfiguration';
2323
import { Utilities } from '../utilities/Utilities';
24-
import { Variants } from './Variants';
2524

2625
const MINIMUM_SUPPORTED_RUSH_JSON_VERSION: string = '0.0.0';
2726

@@ -727,8 +726,8 @@ export class RushConfiguration {
727726
* determines which variant, if any, was last specified when performing "rush install"
728727
* or "rush update".
729728
*/
730-
public get currentInstalledVariant(): Variants.IVariantName {
731-
let variant: Variants.IVariantName;
729+
public get currentInstalledVariant(): string | undefined {
730+
let variant: string | undefined;
732731

733732
if (FileSystem.exists(this._currentVariantJsonFilename)) {
734733
const currentVariantJson: ICurrentVariantJson = JsonFile.load(this._currentVariantJsonFilename);
@@ -751,7 +750,7 @@ export class RushConfiguration {
751750
* Gets the settings from the common-versions.json config file for a specific variant.
752751
* @param variant - The name of the current variant in use by the active command.
753752
*/
754-
public getCommonVersions(variant?: Variants.IVariantName): CommonVersionsConfiguration {
753+
public getCommonVersions(variant?: string | undefined): CommonVersionsConfiguration {
755754
const commonVersionsFilename: string = path.join(this.commonRushConfigFolder,
756755
...(variant ? [RushConstants.rushVariantsFolderName, variant] : []),
757756
RushConstants.commonVersionsFilename);
@@ -762,7 +761,7 @@ export class RushConfiguration {
762761
* Gets the committed shrinkwrap file name for a specific variant.
763762
* @param variant - The name of the current variant in use by the active command.
764763
*/
765-
public getCommittedShrinkwrapFilename(variant?: Variants.IVariantName): string {
764+
public getCommittedShrinkwrapFilename(variant?: string | undefined): string {
766765
if (variant) {
767766
if (!this._variants[variant]) {
768767
throw new Error(
@@ -795,7 +794,7 @@ export class RushConfiguration {
795794
* Gets the PNPM file name for a specific variant.
796795
* @param variant - The name of the current variant in use by the active command.
797796
*/
798-
public getPnpmFilename(variant?: Variants.IVariantName): string {
797+
public getPnpmFilename(variant?: string | undefined): string {
799798
const variantConfigFolderPath: string = this._getVariantConfigFolderPath(variant);
800799

801800
return path.join(
@@ -1096,7 +1095,7 @@ export class RushConfiguration {
10961095
});
10971096
}
10981097

1099-
private _getVariantConfigFolderPath(variant?: Variants.IVariantName): string {
1098+
private _getVariantConfigFolderPath(variant?: string | undefined): string {
11001099
if (variant) {
11011100
if (!this._variants[variant]) {
11021101
throw new Error(

‎apps/rush-lib/src/api/Variants.ts‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ import {
88
* @beta
99
*/
1010
export namespace Variants {
11-
/**
12-
* The type using for the 'variant' value tracked by commands.
13-
* @beta
14-
*/
15-
export type IVariantName = string | undefined;
16-
1711
/**
1812
* Provides the parameter configuration for '--variant'.
1913
* @beta

‎apps/rush-lib/src/api/VersionMismatchFinder.ts‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { RushConfiguration } from './RushConfiguration';
77
import { RushConstants } from '../logic/RushConstants';
88
import { PackageJsonDependency, DependencyType, PackageJsonEditor } from './PackageJsonEditor';
99
import { CommonVersionsConfiguration } from './CommonVersionsConfiguration';
10-
import { Variants } from './Variants';
1110

1211
export interface IVersionMismatchFinderProject {
1312
packageName: string;
@@ -17,15 +16,15 @@ export interface IVersionMismatchFinderProject {
1716
}
1817

1918
export interface IVersionMismatchFinderRushCheckOptions {
20-
variant?: Variants.IVariantName;
19+
variant?: string | undefined;
2120
}
2221

2322
export interface IVersionMismatchFinderEnsureConsistentVersionsOptions {
24-
variant?: Variants.IVariantName;
23+
variant?: string | undefined;
2524
}
2625

2726
export interface IVersionMismatchFinderGetMismatchesOptions {
28-
variant?: Variants.IVariantName;
27+
variant?: string | undefined;
2928
}
3029

3130
/**
@@ -101,7 +100,7 @@ export class VersionMismatchFinder {
101100
rushConfiguration: RushConfiguration,
102101
options: {
103102
isRushCheckCommand: boolean;
104-
variant?: Variants.IVariantName;
103+
variant?: string | undefined;
105104
}): void {
106105

107106
if (rushConfiguration.ensureConsistentVersions || options.isRushCheckCommand) {

‎apps/rush-lib/src/cli/actions/CheckAction.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class CheckAction extends BaseRushAction {
2828
}
2929

3030
protected run(): Promise<void> {
31-
const variant: Variants.IVariantName = this.rushConfiguration.currentInstalledVariant();
31+
const variant: string | undefined = this.rushConfiguration.currentInstalledVariant;
3232

3333
if (!this._variant.value && variant) {
3434
console.log(colors.yellow(

‎apps/rush-lib/src/cli/test/__snapshots__/CommandLineHelp.test.ts.snap‎

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ Optional arguments:
300300
`;
301301
302302
exports[`CommandLineHelp prints the help for each action: link 1`] = `
303-
"usage: rush link [-h] [-f] [--variant VARIANT]
303+
"usage: rush link [-h] [-f]
304304
305305
Create node_modules symlinks for all projects. This operation is normally
306306
performed automatically as part of \\"rush install\\" or \\"rush update\\". You
@@ -309,12 +309,9 @@ reason, or if you specified the \\"--no-link\\" option for \\"rush install\\" or
309309
\\"rush update\\".
310310
311311
Optional arguments:
312-
-h, --help Show this help message and exit.
313-
-f, --force Deletes and recreates all links, even if the filesystem
314-
state seems to indicate that this is unnecessary.
315-
--variant VARIANT Run command using a variant installation configuration.
316-
This parameter may alternatively specified via the
317-
RUSH_VARIANT environment variable.
312+
-h, --help Show this help message and exit.
313+
-f, --force Deletes and recreates all links, even if the filesystem state
314+
seems to indicate that this is unnecessary.
318315
"
319316
`;
320317
@@ -543,7 +540,6 @@ exports[`CommandLineHelp prints the help for each action: version 1`] = `
543540
[--override-version NEW_VERSION] [--bump]
544541
[--bypass-policy] [--version-policy POLICY]
545542
[--override-bump BUMPTYPE] [--override-prerelease-id ID]
546-
[--variant VARIANT]
547543
548544
549545
(EXPERIMENTAL) use this \\"rush version\\" command to ensure version policies and
@@ -580,8 +576,5 @@ Optional arguments:
580576
prerelease id when \\"--bump\\" is provided but only
581577
replaces the prerelease name when
582578
\\"--ensure-version-policy\\" is provided.
583-
--variant VARIANT Run command using a variant installation
584-
configuration. This parameter may alternatively
585-
specified via the RUSH_VARIANT environment variable.
586579
"
587580
`;

‎apps/rush-lib/src/logic/InstallManager.ts‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ const MAX_INSTALL_ATTEMPTS: number = 2;
4848
* As a temporary workaround, augment the type.
4949
*/
5050
import { CreateOptions } from 'tar';
51-
import { Variants } from '../api/Variants';
5251

5352
export interface CreateOptions { // tslint:disable-line:interface-name
5453
/**
@@ -105,7 +104,7 @@ export interface IInstallManagerOptions {
105104
/**
106105
* The variant to consider when performing installations and validating shrinkwrap updates.
107106
*/
108-
variant?: Variants.IVariantName;
107+
variant?: string | undefined;
109108
}
110109

111110
/**
@@ -124,7 +123,7 @@ export class InstallManager {
124123
public static collectImplicitlyPreferredVersions(
125124
rushConfiguration: RushConfiguration,
126125
options: {
127-
variant?: Variants.IVariantName
126+
variant?: string | undefined
128127
} = {}
129128
): Map<string, string> {
130129
// First, collect all the direct dependencies of all local projects, and their versions:
@@ -180,7 +179,7 @@ export class InstallManager {
180179
versionsForDependencies: Map<string, Set<string>>;
181180
dependencies: ReadonlyArray<PackageJsonDependency>;
182181
cyclicDependencies: Set<string>;
183-
variant: Variants.IVariantName;
182+
variant: string | undefined;
184183
}): void {
185184
const {
186185
variant,
@@ -425,7 +424,7 @@ export class InstallManager {
425424
*/
426425
private _createTempModulesAndCheckShrinkwrap(options: {
427426
shrinkwrapFile: BaseShrinkwrapFile | undefined;
428-
variant: Variants.IVariantName;
427+
variant: string | undefined;
429428
}): boolean {
430429
const {
431430
shrinkwrapFile,

‎apps/rush-lib/src/logic/PackageChangeAnalyzer.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { Path } from '@microsoft/node-core-library';
1313
import { RushConstants } from '../logic/RushConstants';
1414
import { RushConfiguration } from '../api/RushConfiguration';
1515
import { Git } from './Git';
16-
import { Variants } from '../api/Variants';
1716

1817
export class PackageChangeAnalyzer {
1918
// Allow this function to be overwritten during unit tests
@@ -131,7 +130,7 @@ export class PackageChangeAnalyzer {
131130
// }
132131

133132
// Determine the current variant from the link JSON.
134-
const variant: Variants.IVariantName = this._rushConfiguration.currentInstalledVariant;
133+
const variant: string | undefined = this._rushConfiguration.currentInstalledVariant;
135134

136135
// Add the shrinkwrap file to every project's dependencies
137136

‎apps/rush-lib/src/logic/PackageJsonUpdater.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { VersionMismatchFinder } from '../api/VersionMismatchFinder';
1111
import { PurgeManager } from './PurgeManager';
1212
import { Utilities } from '../utilities/Utilities';
1313
import { DependencyType, PackageJsonEditor, PackageJsonDependency } from '../api/PackageJsonEditor';
14-
import { Variants } from '../api/Variants';
1514

1615
/**
1716
* The type of SemVer range specifier that is prepended to the version
@@ -63,7 +62,7 @@ export interface IPackageJsonUpdaterRushAddOptions {
6362
/**
6463
* The variant to consider when performing installations and validating shrinkwrap updates.
6564
*/
66-
variant?: Variants.IVariantName;
65+
variant?: string | undefined;
6766
}
6867

6968
/**

‎common/reviews/api/rush-lib.api.ts‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -205,20 +205,16 @@ class RushConfiguration {
205205
readonly commonTempFolder: string;
206206
// @deprecated
207207
readonly commonVersions: CommonVersionsConfiguration;
208-
// WARNING: The type "Variants.IVariantName" needs to be exported by the package (e.g. added to index.ts)
209-
readonly currentInstalledVariant: Variants.IVariantName;
208+
readonly currentInstalledVariant: string | undefined;
210209
readonly currentVariantJsonFilename: string;
211210
readonly ensureConsistentVersions: boolean;
212211
// @beta
213212
readonly eventHooks: EventHooks;
214213
findProjectByShorthandName(shorthandProjectName: string): RushConfigurationProject | undefined;
215214
findProjectByTempName(tempProjectName: string): RushConfigurationProject | undefined;
216-
// WARNING: The type "Variants.IVariantName" needs to be exported by the package (e.g. added to index.ts)
217-
getCommittedShrinkwrapFilename(variant?: Variants.IVariantName): string;
218-
// WARNING: The type "Variants.IVariantName" needs to be exported by the package (e.g. added to index.ts)
219-
getCommonVersions(variant?: Variants.IVariantName): CommonVersionsConfiguration;
220-
// WARNING: The type "Variants.IVariantName" needs to be exported by the package (e.g. added to index.ts)
221-
getPnpmFilename(variant?: Variants.IVariantName): string;
215+
getCommittedShrinkwrapFilename(variant?: string | undefined): string;
216+
getCommonVersions(variant?: string | undefined): CommonVersionsConfiguration;
217+
getPnpmFilename(variant?: string | undefined): string;
222218
getProjectByName(projectName: string): RushConfigurationProject | undefined;
223219
readonly gitAllowedEmailRegExps: string[];
224220
readonly gitSampleEmail: string;
@@ -283,7 +279,6 @@ class RushConfigurationProject {
283279
readonly versionPolicyName: string | undefined;
284280
}
285281

286-
// WARNING: Unsupported export "IVariantName" Currently the "namespace" block only supports constant variables.
287282
// @beta
288283
module Variants {
289284
// (undocumented)

0 commit comments

Comments
 (0)