Skip to content

Commit

Permalink
fix(build-tools): Bump cmd detects ver scheme (#12311)
Browse files Browse the repository at this point in the history
The bump command did not detect the version scheme when bumping unless
it was provided as an argument. This change fixes that so now the scheme
used by the release group will be used if an explicit scheme was not
provided.
  • Loading branch information
tylerbutler authored Oct 6, 2022
1 parent fefcbcc commit 20ee489
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions build-tools/packages/build-cli/src/commands/bump.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import stripAnsi from "strip-ansi";

import { FluidRepo, MonoRepo, Package } from "@fluidframework/build-tools";

import { ReleaseVersion, bumpVersionScheme } from "@fluid-tools/version-tools";
import {
ReleaseVersion,
VersionScheme,
bumpVersionScheme,
detectVersionScheme,
} from "@fluid-tools/version-tools";

import { packageOrReleaseGroupArg } from "../args";
import { BaseCommand } from "../base";
Expand Down Expand Up @@ -65,7 +70,6 @@ export default class BumpCommand extends BaseCommand<typeof BumpCommand.flags> {
const context = await this.getContext();
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const bumpType = flags.bumpType!;
const scheme = flags.scheme;
const shouldInstall = flags.install && !flags.skipChecks;
const shouldCommit = flags.commit && !flags.skipChecks;

Expand All @@ -75,6 +79,7 @@ export default class BumpCommand extends BaseCommand<typeof BumpCommand.flags> {

let repoVersion: ReleaseVersion;
let packageOrReleaseGroup: Package | MonoRepo;
let scheme: VersionScheme | undefined;
const updatedPackages: Package[] = [];

if (isReleaseGroup(args.package_or_release_group)) {
Expand All @@ -85,6 +90,7 @@ export default class BumpCommand extends BaseCommand<typeof BumpCommand.flags> {
);

repoVersion = releaseRepo.version;
scheme = flags.scheme ?? detectVersionScheme(repoVersion);
updatedPackages.push(...releaseRepo.packages);
packageOrReleaseGroup = releaseRepo;
} else {
Expand All @@ -105,6 +111,7 @@ export default class BumpCommand extends BaseCommand<typeof BumpCommand.flags> {
}

repoVersion = releasePackage.version;
scheme = flags.scheme ?? detectVersionScheme(repoVersion);
updatedPackages.push(releasePackage);
packageOrReleaseGroup = releasePackage;
}
Expand Down

0 comments on commit 20ee489

Please sign in to comment.