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

feat(cli): add docusaurus serve --no-clean-urls option #10552

Closed
wants to merge 1 commit into from

Conversation

ZumiFlores
Copy link

@ZumiFlores ZumiFlores commented Oct 3, 2024

This PR adds the ability to configure the cleanUrls option for the serve command, as described in issue #7991. It allows users to toggle clean URLs during local development.

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

Test Plan

Test links

Deploy preview: https://deploy-preview-10552--docusaurus-2.netlify.app/

Related issues/PRs

Fix #7991

@facebook-github-bot
Copy link
Contributor

Hi @ZumiFlores!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

Copy link

netlify bot commented Oct 3, 2024

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit 99208cb
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/66fefecf14984c0008d029d5
😎 Deploy Preview https://deploy-preview-10552--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

github-actions bot commented Oct 3, 2024

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO Report
/ 🟠 58 🟢 98 🟢 96 🟢 100 Report
/docs/installation 🔴 48 🟢 97 🟢 100 🟢 100 Report
/docs/category/getting-started 🟠 73 🟢 100 🟢 100 🟠 86 Report
/blog 🟠 61 🟢 96 🟢 96 🟠 86 Report
/blog/preparing-your-site-for-docusaurus-v3 🔴 47 🟢 92 🟢 100 🟢 100 Report
/blog/tags/release 🟠 63 🟢 96 🟢 96 🟠 86 Report
/blog/tags 🟠 74 🟢 100 🟢 100 🟠 86 Report

@slorber
Copy link
Collaborator

slorber commented Oct 9, 2024

Thanks

Can you please sign the CLA? I can't merge any PR without this.

@slorber slorber added feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. pr: new feature This PR adds a new API or behavior. and removed feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. labels Oct 9, 2024
@slorber slorber changed the title feat: add cleanUrls configuration option to serve command feat(cli): add docusaurus serve --no-clean-urls option Oct 9, 2024
.option('--no-clean-urls', 'Disable clean URLs (keep .html extensions)')
.parse(process.argv);

const { noCleanUrls } = program.opts();
Copy link
Collaborator

@slorber slorber Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI reports error:

Error: 46:11 error 'noCleanUrls' is assigned a value but never used @typescript-eslint/no-unused-vars

You have to actually use the option for the PR to have any meaningful effect

You are not supposed to use Commander in this file, but in bin/docusaurus.mjs

The param of this serve function ServeCLIOptions should contain cleanUrls: boolean and you should pass this arg to serveHandler here:

    serveHandler(req, res, {
      cleanUrls: true,
      public: outDir,
      trailingSlash,
      directoryListing: false,
    });

@slorber slorber closed this Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow configuration of cleanUrls option for serve command
3 participants