try to fix tinyglobby error on windows

This commit is contained in:
sebastien 2025-12-23 15:33:34 +01:00
parent 267a800e7a
commit 1c13e463a0
2 changed files with 7 additions and 4 deletions

View File

@ -6,7 +6,6 @@
*/
import fs from 'fs-extra';
import logger from '@docusaurus/logger';
import traverse, {type Node} from '@babel/traverse';
import generate from '@babel/generator';
import {
@ -56,8 +55,10 @@ export async function extractSourceCodeFileTranslations(
);
return translations;
} catch (err) {
logger.error`Error while attempting to extract Docusaurus translations from source code file at path=${sourceCodeFilePath}.`;
throw err;
throw new Error(
`Error while attempting to extract Docusaurus translations from source code file at path=${sourceCodeFilePath}.`,
{cause: err as Error},
);
}
}

View File

@ -136,6 +136,8 @@ export const isTranslatableSourceFile: (filePath: string) => boolean = (() => {
export async function globTranslatableSourceFiles(
patterns: string[],
): Promise<string[]> {
const filePaths = await safeGlobby(patterns);
const filePaths = await safeGlobby(patterns, {
absolute: true,
});
return filePaths.filter(isTranslatableSourceFile);
}