Skip to content

Commit 9b1e3ea

Browse files
committed
cleanup lint, bundle, and join commands
1 parent 83d2bcd commit 9b1e3ea

File tree

5 files changed

+9
-88
lines changed

5 files changed

+9
-88
lines changed

packages/cli/src/commands/bundle.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
formatPath,
1616
} from '../utils/miscellaneous';
1717

18-
import type { OutputExtensions, Skips, Totals, VerifyConfigOptions } from '../types';
18+
import type { OutputExtensions, Totals, VerifyConfigOptions } from '../types';
1919
import type { CommandArgs } from '../wrapper';
2020

2121
export type BundleOptions = {
@@ -28,8 +28,9 @@ export type BundleOptions = {
2828
metafile?: string;
2929
'remove-unused-components'?: boolean;
3030
'keep-url-references'?: boolean;
31-
} & Skips &
32-
VerifyConfigOptions;
31+
'skip-decorator'?: string[];
32+
'skip-preprocessor'?: string[];
33+
} & VerifyConfigOptions;
3334

3435
export async function handleBundle({
3536
argv,

packages/cli/src/commands/join.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export async function handleJoin({
8888
);
8989
}
9090

91+
// FIXME: decide on the behaviour. Can we join by aliases? If yes, then I'd expect decorators to be applied
9192
const apis = await getFallbackApisOrExit(argv.apis, config);
9293
if (apis.length < 2) {
9394
return exitWithError(`At least 2 APIs should be provided.`);

packages/cli/src/commands/lint.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { getCommandNameFromArgs } from '../utils/getCommandNameFromArgs';
2626
import type { Arguments } from 'yargs';
2727
import type { OutputFormat, ProblemSeverity } from '@redocly/openapi-core';
2828
import type { RawConfigProcessor } from '@redocly/openapi-core/lib/config';
29-
import type { CommandOptions, Skips, Totals, VerifyConfigOptions } from '../types';
29+
import type { CommandOptions, Totals, VerifyConfigOptions } from '../types';
3030
import type { CommandArgs } from '../wrapper';
3131

3232
export type LintOptions = {
@@ -35,8 +35,9 @@ export type LintOptions = {
3535
extends?: string[];
3636
format: OutputFormat;
3737
'generate-ignore-file'?: boolean;
38-
} & Omit<Skips, 'skip-decorator'> &
39-
VerifyConfigOptions;
38+
'skip-rule'?: string[];
39+
'skip-preprocessor'?: string[]; // FIXME: do we need this?
40+
} & VerifyConfigOptions;
4041

4142
export async function handleLint({
4243
argv,

packages/cli/src/index.ts

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -150,48 +150,8 @@ yargs
150150
choices: ['warn', 'error', 'off'] as ReadonlyArray<RuleSeverity>,
151151
default: 'warn' as RuleSeverity,
152152
},
153-
lint: {
154-
hidden: true,
155-
deprecated: true,
156-
},
157-
decorate: {
158-
hidden: true,
159-
deprecated: true,
160-
},
161-
preprocess: {
162-
hidden: true,
163-
deprecated: true,
164-
},
165153
}),
166154
(argv) => {
167-
const DEPRECATED_OPTIONS = ['lint', 'preprocess', 'decorate'];
168-
const DECORATORS_DOCUMENTATION_LINK = 'https://redocly.com/docs/cli/decorators/#decorators';
169-
const JOIN_COMMAND_DOCUMENTATION_LINK = 'https://redocly.com/docs/cli/commands/join/#join';
170-
171-
DEPRECATED_OPTIONS.forEach((option) => {
172-
if (argv[option]) {
173-
process.stdout.write(
174-
`${colors.red(
175-
`Option --${option} is no longer supported. Please review join command documentation ${JOIN_COMMAND_DOCUMENTATION_LINK}.`
176-
)}`
177-
);
178-
process.stdout.write('\n\n');
179-
180-
if (['preprocess', 'decorate'].includes(option)) {
181-
process.stdout.write(
182-
`${colors.red(
183-
`If you are looking for decorators, please review the decorators documentation ${DECORATORS_DOCUMENTATION_LINK}.`
184-
)}`
185-
);
186-
process.stdout.write('\n\n');
187-
}
188-
189-
yargs.showHelp();
190-
process.exit(1);
191-
}
192-
});
193-
194-
process.env.REDOCLY_CLI_COMMAND = 'join';
195155
commandWrapper(handleJoin)(argv);
196156
}
197157
)
@@ -538,24 +498,6 @@ yargs
538498
choices: ['warn', 'error', 'off'] as ReadonlyArray<RuleSeverity>,
539499
default: 'warn' as RuleSeverity,
540500
},
541-
format: {
542-
hidden: true,
543-
deprecated: true,
544-
},
545-
lint: {
546-
hidden: true,
547-
deprecated: true,
548-
},
549-
'skip-rule': {
550-
hidden: true,
551-
deprecated: true,
552-
array: true,
553-
type: 'string',
554-
},
555-
'max-problems': {
556-
hidden: true,
557-
deprecated: true,
558-
},
559501
})
560502
.check((argv) => {
561503
if (argv.output && (!argv.apis || argv.apis.length === 0)) {
@@ -564,24 +506,6 @@ yargs
564506
return true;
565507
}),
566508
(argv) => {
567-
const DEPRECATED_OPTIONS = ['lint', 'format', 'skip-rule', 'max-problems'];
568-
const LINT_AND_BUNDLE_DOCUMENTATION_LINK =
569-
'https://redocly.com/docs/cli/guides/lint-and-bundle/#lint-and-bundle-api-descriptions-with-redocly-cli';
570-
571-
DEPRECATED_OPTIONS.forEach((option) => {
572-
if (argv[option]) {
573-
process.stdout.write(
574-
`${colors.red(
575-
`Option --${option} is no longer supported. Please use separate commands, as described in the ${LINT_AND_BUNDLE_DOCUMENTATION_LINK}.`
576-
)}`
577-
);
578-
process.stdout.write('\n\n');
579-
yargs.showHelp();
580-
process.exit(1);
581-
}
582-
});
583-
584-
process.env.REDOCLY_CLI_COMMAND = 'bundle';
585509
commandWrapper(handleBundle)(argv);
586510
}
587511
)

packages/cli/src/types.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@ export type VerifyConfigOptions = {
5151
'lint-config'?: RuleSeverity;
5252
};
5353

54-
export type Skips = {
55-
'skip-rule'?: string[];
56-
'skip-decorator'?: string[];
57-
'skip-preprocessor'?: string[];
58-
};
59-
6054
export type ConfigApis = Pick<Config, 'apis' | 'configFile'>;
6155

6256
export type PushArguments = ArgumentsCamelCase<PushOptions & CMSPushOptions & { apis: string[] }>;

0 commit comments

Comments
 (0)