chore: move boxen options to constant

This commit is contained in:
Alex Varchuk 2022-09-19 18:46:49 +03:00
parent a51fd38e94
commit a28d86ab7e
No known key found for this signature in database
GPG Key ID: F1FD9569DC4AED04

View File

@ -66,6 +66,14 @@ export const mimeTypes = {
const BUNDLES_DIR = dirname(require.resolve('redoc')); const BUNDLES_DIR = dirname(require.resolve('redoc'));
const boxenOptions = {
title: 'DEPRECATED',
titleAlignment: 'center',
padding: 1,
margin: 1,
borderColor: 'red',
} as boxen.Options;
const builderForBuildCommand = yargs => { const builderForBuildCommand = yargs => {
yargs.positional('spec', { yargs.positional('spec', {
describe: 'path or URL to your spec', describe: 'path or URL to your spec',
@ -185,13 +193,7 @@ YargsParser.command(
console.log(` console.log(`
${boxen( ${boxen(
'This package is deprecated now.\n\nPlease use `@redocly/cli preview-docs <api>` instead.', 'This package is deprecated now.\n\nPlease use `@redocly/cli preview-docs <api>` instead.',
{ boxenOptions,
title: 'DEPRECATED',
titleAlignment: 'center',
padding: 1,
margin: 1,
borderColor: 'red',
},
)}`); )}`);
return res; return res;
}, },
@ -481,13 +483,7 @@ function notifyDeprecation(res: YargsParser.Arguments): YargsParser.Arguments {
console.log( console.log(
boxen( boxen(
'This package is deprecated now.\n\nPlease use `@redocly/cli build-docs <api>` instead.', 'This package is deprecated now.\n\nPlease use `@redocly/cli build-docs <api>` instead.',
{ boxenOptions,
title: 'DEPRECATED',
titleAlignment: 'center',
padding: 1,
margin: 1,
borderColor: 'red',
},
), ),
); );
return res; return res;