Skip to content

Commit 5fc82ca

Browse files
committed
Fix issues
1 parent d097f78 commit 5fc82ca

File tree

5 files changed

+90
-33
lines changed

5 files changed

+90
-33
lines changed

common/reviews/api/rush-lib.api.md

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,12 @@ export interface IGetChangedProjectsOptions {
538538
export interface IGlobalCommand extends IRushCommand {
539539
}
540540

541+
// @public
542+
export interface IIndividualVersionJson extends IVersionPolicyJson {
543+
// (undocumented)
544+
lockedMajor?: number;
545+
}
546+
541547
// @beta
542548
export interface IInputsSnapshot {
543549
getOperationOwnStateHash(project: IRushConfigurationProjectForSnapshot, operationName?: string): string;
@@ -556,6 +562,16 @@ export interface ILaunchOptions {
556562
terminalProvider?: ITerminalProvider;
557563
}
558564

565+
// @public
566+
export interface ILockStepVersionJson extends IVersionPolicyJson {
567+
// (undocumented)
568+
mainProject?: string;
569+
// (undocumented)
570+
nextBump?: string;
571+
// (undocumented)
572+
version: string;
573+
}
574+
559575
// @alpha
560576
export interface ILogFilePaths {
561577
error: string;
@@ -579,9 +595,7 @@ export class IndividualVersionPolicy extends VersionPolicy {
579595
constructor(versionPolicyJson: IIndividualVersionJson);
580596
bump(bumpType?: BumpType, identifier?: string): void;
581597
ensure(project: IPackageJson, force?: boolean): IPackageJson | undefined;
582-
// Warning: (ae-forgotten-export) The symbol "IIndividualVersionJson" needs to be exported by the entry point index.d.ts
583-
//
584-
// (undocumented)
598+
// @internal (undocumented)
585599
readonly _json: IIndividualVersionJson;
586600
get lockedMajor(): number | undefined;
587601
validate(versionString: string, packageName: string): void;
@@ -922,6 +936,22 @@ export interface ITryFindRushJsonLocationOptions {
922936
startingFolder?: string;
923937
}
924938

939+
// @public
940+
export interface IVersionPolicyJson {
941+
// (undocumented)
942+
definitionName: string;
943+
// Warning: (ae-forgotten-export) The symbol "IVersionPolicyDependencyJson" needs to be exported by the entry point index.d.ts
944+
//
945+
// (undocumented)
946+
dependencies?: IVersionPolicyDependencyJson;
947+
// (undocumented)
948+
exemptFromRushChange?: boolean;
949+
// (undocumented)
950+
includeEmailInChangeFile?: boolean;
951+
// (undocumented)
952+
policyName: string;
953+
}
954+
925955
// @internal
926956
export interface _IYarnOptionsJson extends IPackageManagerOptionsJsonBase {
927957
ignoreEngines?: boolean;
@@ -933,10 +963,8 @@ export class LockStepVersionPolicy extends VersionPolicy {
933963
constructor(versionPolicyJson: ILockStepVersionJson);
934964
bump(bumpType?: BumpType, identifier?: string): void;
935965
ensure(project: IPackageJson, force?: boolean): IPackageJson | undefined;
936-
// Warning: (ae-forgotten-export) The symbol "ILockStepVersionJson" needs to be exported by the entry point index.d.ts
937-
//
938-
// (undocumented)
939-
_json: ILockStepVersionJson;
966+
// @internal (undocumented)
967+
readonly _json: ILockStepVersionJson;
940968
get mainProject(): string | undefined;
941969
get nextBump(): BumpType | undefined;
942970
update(newVersionString: string): boolean;
@@ -1611,8 +1639,6 @@ export abstract class VersionPolicy {
16111639
get exemptFromRushChange(): boolean;
16121640
get includeEmailInChangeFile(): boolean;
16131641
get isLockstepped(): boolean;
1614-
// Warning: (ae-forgotten-export) The symbol "IVersionPolicyJson" needs to be exported by the entry point index.d.ts
1615-
//
16161642
// @internal
16171643
readonly _json: IVersionPolicyJson;
16181644
// @internal

libraries/rush-lib/src/api/VersionPolicy.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import * as semver from 'semver';
55
import { type IPackageJson, Enum } from '@rushstack/node-core-library';
66

7-
import {
8-
type IVersionPolicyJson,
9-
type ILockStepVersionJson,
10-
type IIndividualVersionJson,
7+
import type {
8+
IVersionPolicyJson,
9+
ILockStepVersionJson,
10+
IIndividualVersionJson,
1111
VersionFormatForCommit,
1212
VersionFormatForPublish
1313
} from './VersionPolicyConfiguration';
@@ -64,11 +64,11 @@ export abstract class VersionPolicy {
6464
public readonly _json: IVersionPolicyJson;
6565

6666
private get _versionFormatForCommit(): VersionFormatForCommit {
67-
return this._json.dependencies?.versionFormatForCommit ?? VersionFormatForCommit.original;
67+
return this._json.dependencies?.versionFormatForCommit ?? 'original';
6868
}
6969

7070
private get _versionFormatForPublish(): VersionFormatForPublish {
71-
return this._json.dependencies?.versionFormatForPublish ?? VersionFormatForPublish.original;
71+
return this._json.dependencies?.versionFormatForPublish ?? 'original';
7272
}
7373

7474
/**
@@ -164,7 +164,7 @@ export abstract class VersionPolicy {
164164
* to values used for publishing.
165165
*/
166166
public setDependenciesBeforePublish(packageName: string, configuration: RushConfiguration): void {
167-
if (this._versionFormatForPublish === VersionFormatForPublish.exact) {
167+
if (this._versionFormatForPublish === 'exact') {
168168
const project: RushConfigurationProject = configuration.getProjectByName(packageName)!;
169169

170170
const packageJsonEditor: PackageJsonEditor = project.packageJsonEditor;
@@ -190,7 +190,7 @@ export abstract class VersionPolicy {
190190
* to values used for checked-in source.
191191
*/
192192
public setDependenciesBeforeCommit(packageName: string, configuration: RushConfiguration): void {
193-
if (this._versionFormatForCommit === VersionFormatForCommit.wildcard) {
193+
if (this._versionFormatForCommit === 'wildcard') {
194194
const project: RushConfigurationProject = configuration.getProjectByName(packageName)!;
195195

196196
const packageJsonEditor: PackageJsonEditor = project.packageJsonEditor;
@@ -215,7 +215,10 @@ export abstract class VersionPolicy {
215215
* @public
216216
*/
217217
export class LockStepVersionPolicy extends VersionPolicy {
218-
public declare _json: ILockStepVersionJson;
218+
/**
219+
* @internal
220+
*/
221+
public declare readonly _json: ILockStepVersionJson;
219222
private _version: semver.SemVer;
220223

221224
/**
@@ -334,6 +337,9 @@ export class LockStepVersionPolicy extends VersionPolicy {
334337
* @public
335338
*/
336339
export class IndividualVersionPolicy extends VersionPolicy {
340+
/**
341+
* @internal
342+
*/
337343
public declare readonly _json: IIndividualVersionJson;
338344

339345
/**

libraries/rush-lib/src/api/VersionPolicyConfiguration.ts

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ import { VersionPolicy, type BumpType, type LockStepVersionPolicy } from './Vers
77
import type { RushConfigurationProject } from './RushConfigurationProject';
88
import schemaJson from '../schemas/version-policies.schema.json';
99

10+
/**
11+
* This interface represents the raw version policy JSON object which allows repo
12+
* maintainers to define how different groups of projects will be published by Rush,
13+
* and how their version numbers will be determined.
14+
* @public
15+
*/
1016
export interface IVersionPolicyJson {
1117
policyName: string;
1218
definitionName: string;
@@ -15,26 +21,42 @@ export interface IVersionPolicyJson {
1521
includeEmailInChangeFile?: boolean;
1622
}
1723

24+
/**
25+
* This interface represents the raw lock-step version policy JSON object which extends the base version policy
26+
* with additional fields specific to lock-step versioning.
27+
* @public
28+
*/
1829
export interface ILockStepVersionJson extends IVersionPolicyJson {
1930
version: string;
2031
nextBump?: string;
2132
mainProject?: string;
2233
}
2334

35+
/**
36+
* This interface represents the raw individual version policy JSON object which extends the base version policy
37+
* with additional fields specific to individual versioning.
38+
* @public
39+
*/
2440
export interface IIndividualVersionJson extends IVersionPolicyJson {
2541
lockedMajor?: number;
2642
}
2743

28-
export enum VersionFormatForPublish {
29-
original = 'original',
30-
exact = 'exact'
31-
}
44+
/**
45+
* @public
46+
*/
47+
export type VersionFormatForPublish = 'original' | 'exact';
3248

33-
export enum VersionFormatForCommit {
34-
wildcard = 'wildcard',
35-
original = 'original'
36-
}
49+
/**
50+
* @public
51+
*/
52+
export type VersionFormatForCommit = 'wildcard' | 'original';
3753

54+
/**
55+
* This interface represents the `dependencies` field in a version policy JSON object,
56+
* allowing repo maintainers to specify how dependencies' versions should be handled
57+
* during publishing and committing.
58+
* @public
59+
*/
3860
export interface IVersionPolicyDependencyJson {
3961
versionFormatForPublish?: VersionFormatForPublish;
4062
versionFormatForCommit?: VersionFormatForCommit;

libraries/rush-lib/src/api/test/VersionPolicy.test.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import type { IPackageJson } from '@rushstack/node-core-library';
55

66
import {
77
type ILockStepVersionJson,
8-
VersionFormatForCommit,
9-
VersionFormatForPublish,
108
VersionPolicyConfiguration,
119
type IIndividualVersionJson
1210
} from '../VersionPolicyConfiguration';
@@ -125,8 +123,8 @@ describe(VersionPolicy.name, () => {
125123
definitionName: 'lockStepVersion',
126124
policyName: 'test',
127125
dependencies: {
128-
versionFormatForCommit: VersionFormatForCommit.original,
129-
versionFormatForPublish: VersionFormatForPublish.original
126+
versionFormatForCommit: 'original',
127+
versionFormatForPublish: 'original'
130128
},
131129
exemptFromRushChange: true,
132130
includeEmailInChangeFile: true,
@@ -190,8 +188,8 @@ describe(VersionPolicy.name, () => {
190188
definitionName: 'individualVersion',
191189
policyName: 'test',
192190
dependencies: {
193-
versionFormatForCommit: VersionFormatForCommit.original,
194-
versionFormatForPublish: VersionFormatForPublish.original
191+
versionFormatForCommit: 'wildcard',
192+
versionFormatForPublish: 'exact'
195193
},
196194
exemptFromRushChange: true,
197195
includeEmailInChangeFile: true,

libraries/rush-lib/src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,12 @@ export {
107107
VersionPolicy
108108
} from './api/VersionPolicy';
109109

110-
export { VersionPolicyConfiguration } from './api/VersionPolicyConfiguration';
110+
export {
111+
VersionPolicyConfiguration,
112+
type ILockStepVersionJson,
113+
type IIndividualVersionJson,
114+
type IVersionPolicyJson
115+
} from './api/VersionPolicyConfiguration';
111116

112117
export { type ILaunchOptions, Rush } from './api/Rush';
113118
export { RushInternals as _RushInternals } from './api/RushInternals';

0 commit comments

Comments
 (0)