Add deprecation warnings for camelCase flag usage

Log a warning to stderr when users pass the camelCase form of flags
that now have kebab-case as the canonical spelling. The old forms
still work (type-flag handles both natively) but users should migrate.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
This commit is contained in:
Patrik Oldsberg
2026-03-06 15:13:58 +01:00
parent c28e6a7b1c
commit 08b0a7f933
4 changed files with 30 additions and 1 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
'@backstage/cli': patch
---
Migrated remaining CLI command handlers from `commander` to `cleye` for argument parsing. CLI flags are now displayed in kebab-case in help output (e.g. `--success-cache` instead of `--successCache`), but both forms are accepted transparently — no changes needed in existing scripts or CI configurations.
Migrated remaining CLI command handlers from `commander` to `cleye` for argument parsing. Several camelCase CLI flags have been deprecated in favor of their kebab-case equivalents (e.g. `--successCache` `--success-cache`). The old camelCase forms still work but will now log a deprecation warning. Please update any scripts or CI configurations to use the kebab-case versions.
@@ -40,6 +40,19 @@ function depCount(pkg: BackstagePackageJson) {
}
export default async ({ args, info }: CommandContext) => {
for (const flag of [
'outputFile',
'successCache',
'successCacheDir',
'maxWarnings',
]) {
if (args.some(a => a === `--${flag}` || a.startsWith(`--${flag}=`))) {
process.stderr.write(
`DEPRECATION WARNING: --${flag} is deprecated, use the kebab-case form instead\n`,
);
}
}
const {
flags: {
fix,
@@ -19,6 +19,14 @@ import { createNewPackage } from '../lib/createNewPackage';
import type { CommandContext } from '../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
for (const flag of ['skipInstall', 'npmRegistry', 'baseVersion']) {
if (args.some(a => a === `--${flag}` || a.startsWith(`--${flag}=`))) {
process.stderr.write(
`DEPRECATION WARNING: --${flag} is deprecated, use the kebab-case form instead\n`,
);
}
}
const {
flags: {
select,
@@ -134,6 +134,14 @@ export function createFlagFinder(args: string[]) {
export default async ({ args, info }: CommandContext) => {
const testGlobal = global as TestGlobal;
for (const flag of ['successCache', 'successCacheDir', 'jestHelp']) {
if (args.some(a => a === `--${flag}` || a.startsWith(`--${flag}=`))) {
process.stderr.write(
`DEPRECATION WARNING: --${flag} is deprecated, use the kebab-case form instead\n`,
);
}
}
// Parse Backstage-specific flags; unknown flags and arguments are left in
// args so they can be forwarded to Jest.
const { flags: opts } = cli(