Skip to content

fix(utils): always match exclusion root dirs as complete folder paths#7864

Merged
Josh-Cena merged 4 commits into
mainfrom
jc/fix-matcher
Aug 1, 2022
Merged

fix(utils): always match exclusion root dirs as complete folder paths#7864
Josh-Cena merged 4 commits into
mainfrom
jc/fix-matcher

Conversation

@Josh-Cena

Copy link
Copy Markdown
Collaborator

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

Issue surfaced in #7862

Test Plan

Test links

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

Related issues/PRs

@Josh-Cena Josh-Cena added the pr: bug fix This PR fixes a bug in a past release. label Aug 1, 2022
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Aug 1, 2022
@netlify

netlify Bot commented Aug 1, 2022

Copy link
Copy Markdown

[V2]

Name Link
🔨 Latest commit b1ec1b9
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/62e77936e360c000098aae4f
😎 Deploy Preview https://deploy-preview-7864--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 settings.

@github-actions

github-actions Bot commented Aug 1, 2022

Copy link
Copy Markdown

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 84 🟢 98 🟢 100 🟢 100 🟠 80 Report
/docs/installation 🟠 77 🟢 100 🟢 100 🟢 100 🟢 90 Report

function getRelativeFilePath(absoluteFilePath: string) {
const rootFolder = rootFolders.find((folderPath) =>
absoluteFilePath.startsWith(folderPath),
absoluteFilePath.startsWith(addTrailingSlash(folderPath)),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm unsure between addTrailingSlash and addTrailingPathSeparator. Tentatively went with addTrailingSlash; no one reported the bug before anyway so it won't be a regression

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

OK, never mind: Windows tests tell me that addTrailingPathSeparator is the right one...

@github-actions

github-actions Bot commented Aug 1, 2022

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 812 kB

ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 52.8 kB
website/build/assets/css/styles.********.css 110 kB
website/build/assets/js/main.********.js 609 kB
website/build/index.html 40.7 kB

compressed-size-action

Comment on lines +72 to +74
[addSuffix(folderPath, '/'), addSuffix(folderPath, '\\')].some((p) =>
absoluteFilePath.startsWith(p),
),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Hacky but this will work for everyone. Remember that a single config may be used to build sites on both Windows and Unix, so we need to cater to 2×2 = 4 cases. I would merge like this.

@Josh-Cena Josh-Cena merged commit 40827c6 into main Aug 1, 2022
@Josh-Cena Josh-Cena deleted the jc/fix-matcher branch August 1, 2022 07:23
This was referenced Oct 19, 2023
mrizwanashiq pushed a commit to mrizwanashiq/docusaurus that referenced this pull request Jun 25, 2026
…facebook#7864)

* fix(utils): always match exclusion root dirs as complete folder paths

* fix

* fix?

* fix for real
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants