fix: eject command with no component specified (#1709)

This commit is contained in:
Andrew Tatomyr
2024-09-05 13:22:18 +03:00
committed by GitHub
parent 81a1ecace6
commit 8240c78388
4 changed files with 9 additions and 5 deletions

View File

@@ -0,0 +1,5 @@
---
"@redocly/cli": patch
---
Added the ability to run the `eject` command without specifying components, which displays a selectable list of all available components.

View File

@@ -5,7 +5,7 @@ import type { VerifyConfigOptions } from '../types';
export type EjectOptions = {
type: 'component';
path: string;
path?: string;
'project-dir'?: string;
force: boolean;
} & VerifyConfigOptions;
@@ -20,7 +20,7 @@ export const handleEject = async ({ argv }: CommandArgs<EjectOptions>) => {
'@redocly/realm',
'eject',
`${argv.type}`,
`${argv.path}`,
`${argv.path ?? ''}`,
`-d=${argv['project-dir']}`,
argv.force ? `--force=${argv.force}` : '',
],

View File

@@ -26,7 +26,7 @@ export const previewProject = async ({ argv }: CommandArgs<PreviewProjectOptions
spawn(
npxExecutableName,
['-y', packageName, 'develop', `--plan=${plan}`, `--port=${port || 4000}`],
['-y', packageName, 'preview', `--plan=${plan}`, `--port=${port || 4000}`],
{
stdio: 'inherit',
cwd: projectDir,

View File

@@ -817,7 +817,7 @@ yargs
}
)
.command(
'eject <type> <path>',
'eject <type> [path]',
'Helper function to eject project elements for customization.',
(yargs) =>
yargs
@@ -830,7 +830,6 @@ yargs
.positional('path', {
description: 'Filepath to a component or filepath with glob pattern.',
type: 'string',
demandOption: true,
})
.options({
'project-dir': {