mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-09 23:27:28 +02:00
Update messages for versioning
This commit is contained in:
parent
cdea25eceb
commit
88359ea845
3 changed files with 16 additions and 7 deletions
|
@ -20,7 +20,7 @@ const ENABLE_TRANSLATION = fs.existsSync(CWD + "/languages.js");
|
|||
|
||||
let versions;
|
||||
if (fs.existsSync(CWD + "/versions.json")) {
|
||||
versions = require(CWD + "/versions.json");
|
||||
versions = require(CWD + "/versions.json");
|
||||
} else {
|
||||
versions = [];
|
||||
}
|
||||
|
@ -124,7 +124,9 @@ function docVersion(id, req_version) {
|
|||
return versions[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
throw new Error(
|
||||
`No document available to use for version ${req_version} of document with id ${id}. Verify that all version files are correct.`
|
||||
);
|
||||
}
|
||||
|
||||
// returns whether a given file has content that differ from the
|
||||
|
@ -226,7 +228,7 @@ function docData() {
|
|||
// return the version of the sidebar to use given a requested version
|
||||
function sidebarVersion(req_version) {
|
||||
// iterate through versions until a version less than or equal to the requested
|
||||
// is found, then check if that verison has an available file to use
|
||||
// is found, then check if that version has an available file to use
|
||||
let requestedFound = false;
|
||||
for (let i = 0; i < versions.length; i++) {
|
||||
if (versions[i] === req_version) {
|
||||
|
@ -243,7 +245,9 @@ function sidebarVersion(req_version) {
|
|||
return versions[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
throw new Error(
|
||||
`No sidebar file available to use for version ${req_version}. Verify that all version files are correct.`
|
||||
);
|
||||
}
|
||||
|
||||
// return whether or not the current sidebars.json file differs from the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue