From ad0c061b77235ec459058d4273fb85a94e6d9174 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Wed, 6 Sep 2023 20:17:55 +0200 Subject: [PATCH] cli: adjust repo fix check msg based on repo scripts Signed-off-by: Patrik Oldsberg --- packages/cli/src/commands/repo/fix.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/repo/fix.ts b/packages/cli/src/commands/repo/fix.ts index 2d46897d52..75306f226c 100644 --- a/packages/cli/src/commands/repo/fix.ts +++ b/packages/cli/src/commands/repo/fix.ts @@ -22,6 +22,7 @@ import { import { OptionValues } from 'commander'; import fs from 'fs-extra'; import { resolve as resolvePath } from 'path'; +import { paths } from '../../lib/paths'; /** * A mutable object representing a package.json file with potential fixes. @@ -38,8 +39,13 @@ export async function readFixablePackages(): Promise { export function printPackageFixHint(packages: FixablePackage[]) { const changed = packages.filter(pkg => pkg.changed); if (changed.length > 0) { + const rootPkg = require(paths.resolveTargetRoot('package.json')); + const fixCmd = + rootPkg.scripts?.fix === 'backstage-cli repo fix' + ? 'fix' + : 'backstage-cli repo fix'; console.log( - 'The following packages are out of sync, run `yarn fix` to fix them:', + `The following packages are out of sync, run 'yarn ${fixCmd}' to fix them:`, ); for (const pkg of changed) { console.log(` ${pkg.packageJson.name}`);