Fix removal of semver usage

This commit is contained in:
Frank Li 2017-08-04 12:57:43 -07:00
parent 63043c041a
commit 5c3f74ddcc

View file

@ -8,7 +8,6 @@
*/
const CWD = process.cwd();
const semver = require("semver");
const glob = require("glob");
const fs = require("fs");
const path = require("path");
@ -102,8 +101,14 @@ files.forEach(file => {
// returns the version to use for a document based on its id and
// what the requested version is
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++) {
if (semver.gt(versions[i], req_version)) {
if (versions[i] === req_version) {
requestedFound = true;
}
if (!requestedFound) {
continue;
}
if (!available[id]) {
@ -214,8 +219,14 @@ 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
let requestedFound = false;
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;
}
if (