Skip to content

Commit

Permalink
fix(bump:deps): Allow bumping server deps (#16313)
Browse files Browse the repository at this point in the history
The `bump deps` command was preventing server minor bumps. This was a
little too strict. I changed it so it now prompts the user to confirm if
they're trying to bump server deps on any branch other than next.
  • Loading branch information
tylerbutler authored Jul 11, 2023
1 parent 4d0d6cc commit 4098adf
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions build-tools/packages/build-cli/src/commands/bump/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
import { Flags } from "@oclif/core";
import chalk from "chalk";
import prompts from "prompts";
import stripAnsi from "strip-ansi";

import { FluidRepo, MonoRepo, MonoRepoKind } from "@fluidframework/build-tools";
Expand Down Expand Up @@ -124,21 +125,25 @@ export default class DepsCommand extends BaseCommand<typeof DepsCommand> {

const branchName = await context.gitRepo.getCurrentBranchName();

// can be removed once server team owns their releases
if (args.package_or_release_group === MonoRepoKind.Server && flags.updateType === "minor") {
this.error(`Server release are always a ${chalk.bold("MAJOR")} release`);
}
if (args.package_or_release_group === MonoRepoKind.Server && branchName !== "next") {
const { confirmed } = await prompts({
type: "confirm",
name: "confirmed",
message: `Server releases should be consumed in the ${chalk.bold(
"next",
)} branch only. The current branch is ${branchName}. Are you sure you want to continue?`,
initial: false,
onState: (state: any) => {
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
if (state.aborted) {
process.nextTick(() => this.exit(0));
}
},
});

if (args.package_or_release_group === MonoRepoKind.Server && flags.prerelease === true) {
this.info(
`${chalk.red.bold(
"Client packages on main branch should NOT be consuming prereleases from server. Server prereleases should be consumed in next branch only",
)}`,
);
if (branchName !== "next") {
this.error(
`Server prereleases should be consumed in ${chalk.bold("next")} branch only`,
);
if (confirmed !== true) {
this.info("Cancelled");
this.exit(0);
}
}

Expand Down

0 comments on commit 4098adf

Please sign in to comment.