diff --git a/.changeset/wicked-birds-jam.md b/.changeset/wicked-birds-jam.md new file mode 100644 index 0000000000..2ddad44c5d --- /dev/null +++ b/.changeset/wicked-birds-jam.md @@ -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. diff --git a/packages/cli/src/commands/eject.ts b/packages/cli/src/commands/eject.ts index b02d4b879b..ad7258d395 100644 --- a/packages/cli/src/commands/eject.ts +++ b/packages/cli/src/commands/eject.ts @@ -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) => { '@redocly/realm', 'eject', `${argv.type}`, - `${argv.path}`, + `${argv.path ?? ''}`, `-d=${argv['project-dir']}`, argv.force ? `--force=${argv.force}` : '', ], diff --git a/packages/cli/src/commands/preview-project/index.ts b/packages/cli/src/commands/preview-project/index.ts index cedc6e501a..05a74805a6 100644 --- a/packages/cli/src/commands/preview-project/index.ts +++ b/packages/cli/src/commands/preview-project/index.ts @@ -26,7 +26,7 @@ export const previewProject = async ({ argv }: CommandArgs ', + 'eject [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': {