1
mirror of https://github.com/jakejarvis/hugo-extended.git synced 2025-04-26 13:28:28 -04:00

chmod hugo[.exe] to ensure it's executable

This commit is contained in:
Jake Jarvis 2021-10-06 12:32:07 -04:00
parent 36ec7bde36
commit 102d7a7ca7
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39
3 changed files with 11 additions and 6 deletions

View File

@ -1,4 +1,5 @@
import path from "path";
import fs from "fs";
import { execFileSync } from "child_process";
import { readPackageUpAsync } from "read-pkg-up";
import downloader from "careful-downloader";
@ -27,6 +28,7 @@ async function installHugo() {
const downloadBaseUrl = `https://github.com/gohugoio/hugo/releases/download/v${version}/`;
const releaseFile = getArchiveFilename(version, process.platform, process.arch);
const checksumFile = `hugo_${version}_checksums.txt`;
const binFile = process.platform === "win32" ? "hugo.exe" : "hugo";
// stop here if there's nothing we can download
if (!releaseFile) {
@ -46,8 +48,11 @@ async function installHugo() {
},
);
// ensure hugo[.exe] is executable
fs.chmodSync(path.join(download, binFile), 0o755);
// return the full path to our Hugo binary
return path.join(download, process.platform === "win32" ? "hugo.exe" : "hugo");
return path.join(download, binFile);
}
// Hugo Extended supports: macOS x64, macOS ARM64, Linux x64, Windows x64.

View File

@ -27,7 +27,7 @@
"exports": "./index.js",
"types": "./index.d.ts",
"dependencies": {
"careful-downloader": "^1.1.0",
"careful-downloader": "^1.2.0",
"chalk": "^4.1.2",
"read-pkg-up": "^8.0.0"
},

View File

@ -399,10 +399,10 @@ caniuse-lite@^1.0.30001251, caniuse-lite@^1.0.30001264:
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001265.tgz#0613c9e6c922e422792e6fcefdf9a3afeee4f8c3"
integrity sha512-YzBnspggWV5hep1m9Z6sZVLOt7vrju8xWooFAgN6BA5qvy98qPAPb7vNUzypFaoh2pb3vlfzbDO8tB57UPGbtw==
careful-downloader@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/careful-downloader/-/careful-downloader-1.1.0.tgz#c7c64eb55631f55f2512788fa1e4e833c27728fa"
integrity sha512-BQCb7f7Qa/sR/V2lKn730DV/Li+0WV/LTnHy+x6pIfvZ6WkoG+MnStRkiuJp2reSNe5upBlIWg6iuQiKJgeq1g==
careful-downloader@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/careful-downloader/-/careful-downloader-1.2.0.tgz#9f4e6375860231d47719ac12c5a40e28d6d8b788"
integrity sha512-erW3AZYO1Ih5qiR+NJKUx9YkItIddshWL9W/Zd10EiGpH60cfj4kgtKyr9mq4dY0QpysMjaezRFNqZa29rxTEw==
dependencies:
decompress "^4.2.1"
fs-extra "^10.0.0"