fix(cli): add user feedback when opening config docs in browser
The config:docs command previously only logged 'Loaded config from app-config.yaml' and silently attempted to open the browser, providing no feedback about what was happening. This change adds clear console output to indicate the browser is being opened and displays the URL. This approach provides better user experience by: - Showing users that the command is attempting to open their browser - Displaying the full URL being opened for transparency - Providing fallback instructions if the browser fails to open Fixes #29512 Signed-off-by: Josephine Pfeiffer <hi@josie.lol>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/cli': patch
|
||||
---
|
||||
|
||||
Added user feedback when opening config docs in browser. The command now clearly indicates what it's doing and provides fallback instructions if the browser fails to open.
|
||||
@@ -19,6 +19,7 @@ import { mergeConfigSchemas } from '@backstage/config-loader';
|
||||
import { OptionValues } from 'commander';
|
||||
import { JSONSchema7 as JSONSchema } from 'json-schema';
|
||||
import openBrowser from 'react-dev-utils/openBrowser';
|
||||
import chalk from 'chalk';
|
||||
import { loadCliConfig } from '../lib/config';
|
||||
|
||||
const DOCS_URL = 'https://config.backstage.io';
|
||||
@@ -36,5 +37,23 @@ export default async (opts: OptionValues) => {
|
||||
),
|
||||
);
|
||||
|
||||
openBrowser(`${DOCS_URL}#schema=${JSON.stringify(schema)}`);
|
||||
const url = `${DOCS_URL}#schema=${JSON.stringify(schema)}`;
|
||||
|
||||
console.log();
|
||||
console.log(
|
||||
chalk.cyan(
|
||||
'Opening configuration reference documentation in your browser...',
|
||||
),
|
||||
);
|
||||
console.log(` ${chalk.cyan(url)}`);
|
||||
console.log();
|
||||
|
||||
const opened = openBrowser(url);
|
||||
|
||||
if (!opened) {
|
||||
console.log(
|
||||
chalk.yellow('⚠️ WARNING: Unable to open browser automatically.'),
|
||||
);
|
||||
console.log(chalk.yellow('Please open the URL manually in your browser.'));
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user