mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-26 06:27:59 +02:00
Fix removal of semver usage
This commit is contained in:
parent
63043c041a
commit
5c3f74ddcc
1 changed files with 14 additions and 3 deletions
|
@ -8,7 +8,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const CWD = process.cwd();
|
const CWD = process.cwd();
|
||||||
const semver = require("semver");
|
|
||||||
const glob = require("glob");
|
const glob = require("glob");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
@ -102,8 +101,14 @@ files.forEach(file => {
|
||||||
// returns the version to use for a document based on its id and
|
// returns the version to use for a document based on its id and
|
||||||
// what the requested version is
|
// what the requested version is
|
||||||
function docVersion(id, req_version) {
|
function docVersion(id, 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
|
||||||
|
let requestedFound = false;
|
||||||
for (let i = 0; i < versions.length; i++) {
|
for (let i = 0; i < versions.length; i++) {
|
||||||
if (semver.gt(versions[i], req_version)) {
|
if (versions[i] === req_version) {
|
||||||
|
requestedFound = true;
|
||||||
|
}
|
||||||
|
if (!requestedFound) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!available[id]) {
|
if (!available[id]) {
|
||||||
|
@ -214,8 +219,14 @@ function docData() {
|
||||||
|
|
||||||
// return the version of the sidebar to use given a requested version
|
// return the version of the sidebar to use given a requested version
|
||||||
function sidebarVersion(req_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
|
||||||
|
let requestedFound = false;
|
||||||
for (let i = 0; i < versions.length; i++) {
|
for (let i = 0; i < versions.length; i++) {
|
||||||
if (semver.gt(versions[i], req_version)) {
|
if (versions[i] === req_version) {
|
||||||
|
requestedFound = true;
|
||||||
|
}
|
||||||
|
if (!requestedFound) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue