check for a hugoVersion package.json field just in case the package version does not and/or cannot align with Hugo in the future (should never happen!)

This commit is contained in:
jake committed 2021-10-09 11:32:48 -04:00
1 parent 0f1844f49e
commit eddc6a62a1
2 files changed
+15 -4

No files matched your search

+11 -2
View File
@@ -2,12 +2,20 @@ import path from "path";
import fs from "fs";
import downloader from "careful-downloader";
import logSymbols from "log-symbols";
import { getPkgVersion, getReleaseUrl, getReleaseFilename, getBinFilename, getBinVersion, getChecksumFilename, isExtended } from "./utils.js";
import {
getPkgVersion,
getReleaseUrl,
getReleaseFilename,
getBinFilename,
getBinVersion,
getChecksumFilename,
isExtended,
} from "./utils.js";
installHugo()
.then((bin) =>
// try querying hugo's version via CLI
getBinVersion(bin),
getBinVersion(bin),
)
.then((version) => {
// print output of `hugo version` to console
@@ -36,6 +44,7 @@ async function installHugo() {
console.warn(`${logSymbols.info} Hugo Extended isn't supported on this platform, downloading vanilla Hugo instead.`);
}
// download release from GitHub and verify its checksum
const download = await downloader(
getReleaseUrl(version, releaseFile),
getReleaseUrl(version, checksumFile),