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

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

* fix

* fix?

* fix for real
This commit is contained in:
Joshua Chen 2022-08-01 15:23:01 +08:00 committed by GitHub
parent 3a0e90eacd
commit 40827c6c72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 5 deletions
packages/docusaurus-utils/src

View file

@ -9,6 +9,7 @@
import path from 'path';
import Micromatch from 'micromatch'; // Note: Micromatch is used by Globby
import {addSuffix} from './jsUtils';
/** A re-export of the globby instance. */
export {default as Globby} from 'globby';
@ -68,7 +69,9 @@ export function createAbsoluteFilePathMatcher(
function getRelativeFilePath(absoluteFilePath: string) {
const rootFolder = rootFolders.find((folderPath) =>
absoluteFilePath.startsWith(folderPath),
[addSuffix(folderPath, '/'), addSuffix(folderPath, '\\')].some((p) =>
absoluteFilePath.startsWith(p),
),
);
if (!rootFolder) {
throw new Error(