You've already forked hugo-extended
mirror of
https://github.com/jakejarvis/hugo-extended.git
synced 2026-06-14 15:45:27 -04:00
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:
+11
-2
@@ -2,12 +2,20 @@ import path from "path";
|
|||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import downloader from "careful-downloader";
|
import downloader from "careful-downloader";
|
||||||
import logSymbols from "log-symbols";
|
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()
|
installHugo()
|
||||||
.then((bin) =>
|
.then((bin) =>
|
||||||
// try querying hugo's version via CLI
|
// try querying hugo's version via CLI
|
||||||
getBinVersion(bin),
|
getBinVersion(bin),
|
||||||
)
|
)
|
||||||
.then((version) => {
|
.then((version) => {
|
||||||
// print output of `hugo version` to console
|
// 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.`);
|
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(
|
const download = await downloader(
|
||||||
getReleaseUrl(version, releaseFile),
|
getReleaseUrl(version, releaseFile),
|
||||||
getReleaseUrl(version, checksumFile),
|
getReleaseUrl(version, checksumFile),
|
||||||
|
|||||||
+4
-2
@@ -1,10 +1,12 @@
|
|||||||
import { readPackageUpSync } from "read-pkg-up";
|
|
||||||
import { execFileSync } from "child_process";
|
import { execFileSync } from "child_process";
|
||||||
|
import { readPackageUpSync } from "read-pkg-up";
|
||||||
|
|
||||||
// This package's version number (should) always match the Hugo release we want.
|
// This package's version number (should) always match the Hugo release we want.
|
||||||
|
// We check for a `hugoVersion` field in package.json just in case it doesn't
|
||||||
|
// match in the future (from pushing an emergency package update, etc.).
|
||||||
export function getPkgVersion() {
|
export function getPkgVersion() {
|
||||||
const { packageJson } = readPackageUpSync();
|
const { packageJson } = readPackageUpSync();
|
||||||
return packageJson.version;
|
return packageJson.hugoVersion || packageJson.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate the full GitHub URL to a given release file.
|
// Generate the full GitHub URL to a given release file.
|
||||||
|
|||||||
Reference in New Issue
Block a user