Skip to content

Commit f28caae

Browse files
committed
Minor cleanup.
1 parent 22d75a3 commit f28caae

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

libraries/rush-lib/src/cli/actions/ChangeAction.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ export class ChangeAction extends BaseRushAction {
320320

321321
const existingChangeComments: Map<string, string[]> = ChangeFiles.getChangeComments(
322322
this.terminal,
323-
await this._getChangeFilesAsync()
323+
await this._getChangeFilesSinceBaseBranchAsync()
324324
);
325325
changeFileData = await this._promptForChangeFileDataAsync(
326326
promptModule,
@@ -393,7 +393,7 @@ export class ChangeAction extends BaseRushAction {
393393
if (strictValidation) {
394394
filesToValidate = await changeFilesInstance.getAllChangeFilesAsync();
395395
} else {
396-
filesToValidate = await this._getChangeFilesAsync();
396+
filesToValidate = await this._getChangeFilesSinceBaseBranchAsync();
397397
}
398398

399399
if (changedProjectNames.length > 0 || filesToValidate.length > 0) {
@@ -492,21 +492,20 @@ export class ChangeAction extends BaseRushAction {
492492
}
493493

494494
const oldRushJson: IRushConfigurationJson = JsonFile.parseString(oldRushJsonContent);
495-
const currentProjectNames: Set<string> = new Set(
496-
this.rushConfiguration.projects.map((p) => p.packageName)
497-
);
495+
const currentProjectsByName: ReadonlyMap<string, RushConfigurationProject> =
496+
this.rushConfiguration.projectsByName;
498497

499498
const deletedProjectNames: Set<string> = new Set<string>();
500-
for (const project of oldRushJson.projects) {
501-
if (!currentProjectNames.has(project.packageName)) {
502-
deletedProjectNames.add(project.packageName);
499+
for (const { packageName } of oldRushJson.projects) {
500+
if (!currentProjectsByName.has(packageName)) {
501+
deletedProjectNames.add(packageName);
503502
}
504503
}
505504

506505
return deletedProjectNames;
507506
}
508507

509-
private async _getChangeFilesAsync(): Promise<string[]> {
508+
private async _getChangeFilesSinceBaseBranchAsync(): Promise<string[]> {
510509
const repoRoot: string = getRepoRoot(this.rushConfiguration.rushJsonFolder);
511510
const relativeChangesFolder: string = path.relative(repoRoot, this.rushConfiguration.changesFolder);
512511
const targetBranch: string = await this._getTargetBranchAsync();

0 commit comments

Comments
 (0)