mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-20 10:08:17 +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;
|
options: PluginOptions;
|
||||||
versionsMetadata: VersionMetadata[];
|
versionsMetadata: VersionMetadata[];
|
||||||
}): Promise<string | undefined> {
|
}): 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');
|
const filePath = path.join(dataDir, '__mdx-loader-dependency.json');
|
||||||
// the cache is invalidated whenever this file content changes
|
// the cache is invalidated whenever this file content changes
|
||||||
const fileContent = {
|
const fileContent = {
|
||||||
|
|
|
@ -38,6 +38,12 @@ type LoadVersionParams = {
|
||||||
|
|
||||||
function ensureNoDuplicateDocId(docs: DocMetadataBase[]): void {
|
function ensureNoDuplicateDocId(docs: DocMetadataBase[]): void {
|
||||||
const duplicatesById = _.chain(docs)
|
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)
|
.groupBy((d) => d.id)
|
||||||
.pickBy((group) => group.length > 1)
|
.pickBy((group) => group.length > 1)
|
||||||
.value();
|
.value();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue