Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended CLI commands no longer appear in -h or --help output #10681

Closed
4 of 7 tasks
sserrata opened this issue Nov 14, 2024 · 2 comments · Fixed by #10685
Closed
4 of 7 tasks

Extended CLI commands no longer appear in -h or --help output #10681

sserrata opened this issue Nov 14, 2024 · 2 comments · Fixed by #10685
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@sserrata
Copy link
Contributor

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

Using extendCli to extend the docusaurus CLI with new commands no longer includes those commands, i.e. usage, description, arguments, options, when executing docusaurus --help or docusaurus -h.

However, the extended commands do appear in the console output after attempting to call an unknown command.

I verified that extended command usage does appear in prior docusaurus release, e.g. v2.4.3 but have not tested releases in between that and the current release.

Reproducible demo

https://codesandbox.io/p/devbox/elegant-water-docusaurus?privacy=public

Steps to reproduce

  1. Bootstrap a fresh docusaurus site
  2. Create the example plugin referenced in the extendCli docs.
  3. Update docusaurus.config.js to include the new plugin.
  4. Execute yarn docusaurus -h and observe the extended command is not present in help output.
  5. Execute yarn docusaurus foo and observe the extended command in the output.

Expected behavior

When executing yarn docusaurus -h I expect to see my extended command usage, description, options, etc., in the output.

Actual behavior

Running yarn docusaurus -h not not include the usage for my extended command. However, my extended command does appear when I attempt to pass an invalid command argument.

Your environment

Self-service

  • I'd be willing to fix this bug myself.
@sserrata sserrata added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Nov 14, 2024
@sserrata
Copy link
Contributor Author

CLI output from my repro:

$ docusaurus -h

    ------------------------------------------------------------------------------------------------------------------------------------------------ 
                                                                                                                                                     
                                                             Update available 3.6.0 → 3.6.1                                                          
                                                                                                                                                     
                                    To upgrade Docusaurus packages with the latest version, run the following command:                               
         `yarn upgrade @docusaurus/core@latest @docusaurus/preset-classic@latest @docusaurus/module-type-aliases@latest @docusaurus/types@latest`    
                                                                                                                                                     
    ------------------------------------------------------------------------------------------------------------------------------------------------ 

Usage: docusaurus <command> [options]

Options:
  -V, --version                                            output the version number
  -h, --help                                               display help for command

Commands:
  build [options] [siteDir]                                Build website.
  swizzle [options] [themeName] [componentName] [siteDir]  Wraps or ejects the original theme files into website folder for customization.
  deploy [options] [siteDir]                               Deploy website to GitHub pages.
  start [options] [siteDir]                                Start the development server.
  serve [options] [siteDir]                                Serve website locally.
  clear [siteDir]                                          Remove build artifacts.
  write-translations [options] [siteDir]                   Extract required translations of your site.
  write-heading-ids [options] [siteDir] [files...]         Generate heading ids in Markdown content.
Done in 1.56s.

➜  workspace git:(master) ✗ yarn docusaurus foo
yarn run v1.22.19
$ docusaurus foo

    ------------------------------------------------------------------------------------------------------------------------------------------------ 
                                                                                                                                                     
                                                             Update available 3.6.0 → 3.6.1                                                          
                                                                                                                                                     
                                    To upgrade Docusaurus packages with the latest version, run the following command:                               
         `yarn upgrade @docusaurus/core@latest @docusaurus/preset-classic@latest @docusaurus/module-type-aliases@latest @docusaurus/types@latest`    
                                                                                                                                                     
    ------------------------------------------------------------------------------------------------------------------------------------------------ 

Usage: docusaurus <command> [options]

Options:
  -V, --version                                            output the version number
  -h, --help                                               display help for command

Commands:
  build [options] [siteDir]                                Build website.
  swizzle [options] [themeName] [componentName] [siteDir]  Wraps or ejects the original theme files into website folder for customization.
  deploy [options] [siteDir]                               Deploy website to GitHub pages.
  start [options] [siteDir]                                Start the development server.
  serve [options] [siteDir]                                Serve website locally.
  clear [siteDir]                                          Remove build artifacts.
  write-translations [options] [siteDir]                   Extract required translations of your site.
  write-heading-ids [options] [siteDir] [files...]         Generate heading ids in Markdown content.
  docs:version <version>                                   Tag a new docs version
  roll                                                     Roll a random number between 1 and 1000
[ERROR] Unknown Docusaurus CLI command foo.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
➜  workspace git:(master) ✗ 

@slorber
Copy link
Collaborator

slorber commented Nov 15, 2024

Thanks, I'll take a look

Looks like I broken something here #10368

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants