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
@@ -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(