mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-17 08:37:57 +02:00
Merge branch 'main' into slorber/do-not-translate-default-locale
This commit is contained in:
commit
c79a3cbb05
2 changed files with 12 additions and 0 deletions
|
@ -62,6 +62,12 @@ async function createMdxLoaderDependencyFile({
|
|||
options: PluginOptions;
|
||||
versionsMetadata: VersionMetadata[];
|
||||
}): Promise<string | undefined> {
|
||||
// Disabled for unit tests, the side effect produces infinite watch loops
|
||||
// TODO find a better way :/
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const filePath = path.join(dataDir, '__mdx-loader-dependency.json');
|
||||
// the cache is invalidated whenever this file content changes
|
||||
const fileContent = {
|
||||
|
|
|
@ -38,6 +38,12 @@ type LoadVersionParams = {
|
|||
|
||||
function ensureNoDuplicateDocId(docs: DocMetadataBase[]): void {
|
||||
const duplicatesById = _.chain(docs)
|
||||
.sort((d1, d2) => {
|
||||
// Need to sort because Globby order is non-deterministic
|
||||
// TODO maybe we should create a deterministic glob utils?
|
||||
// see https://github.com/sindresorhus/globby/issues/131
|
||||
return d1.source.localeCompare(d2.source);
|
||||
})
|
||||
.groupBy((d) => d.id)
|
||||
.pickBy((group) => group.length > 1)
|
||||
.value();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue