Binary wrapper for Hugo
- hugo-bin supports the withdeploy Hugo version
- hugo-bin supports the Extended Hugo version for Hugo versions before 0.170.0
- For usage within corporate networks or behind corporate proxies, the download repository can be overwritten
See Installation options for more details.
npm install hugo-bin --save-devHugo is downloaded by hugo-bin's postinstall script. If it didn't run (--ignore-scripts, or your package manager doesn't allow it), run npm rebuild hugo-bin. With npm's allowScripts, approve it first with npm approve-scripts hugo-bin.
import { execFile } from 'node:child_process';
import hugoPath from 'hugo-bin';
execFile(hugoPath, ['version'], (error, stdout) => {
if (error) {
throw error;
}
console.log(stdout);
});npm exec hugo help
npm run create -- post/my-new-post.md # see below 'npm run-script'npm exec hugo help
rem see below 'npm run-script'
npm run create -- post/my-new-post.md{
"scripts": {
"build": "hugo",
"create": "hugo new",
"serve": "hugo server"
}
}See the Hugo Documentation for more information.
Note: If you change any of these options, run
npm rebuild hugo-binto download Hugo again.
hugo-bin supports options to change the variation of Hugo binaries, to overwrite the download repository and the Hugo version.
Each option can be configured in one of the following ways:
{
"name": "your-package",
"version": "0.0.1",
"hugo-bin": {
"buildTags": "withdeploy",
"downloadRepo": "https://some.example.com/artifactory/github-releases",
"version": "0.124.1"
}
}As local or global .npmrc configuration file
hugo_bin_build_tags = "withdeploy"
hugo_bin_download_repo = "https://some.example.com/artifactory/github-releases"
hugo_bin_hugo_version = "0.124.1"On Linux/macOS:
export HUGO_BIN_BUILD_TAGS="withdeploy"
export HUGO_BIN_DOWNLOAD_REPO="https://some.example.com/artifactory/github-releases"
export HUGO_BIN_HUGO_VERSION="0.124.1"On Windows:
set HUGO_BIN_BUILD_TAGS=withdeploy
set HUGO_BIN_DOWNLOAD_REPO=https://some.example.com/artifactory/github-releases
set HUGO_BIN_HUGO_VERSION=0.124.1- Type:
string - Default:
""
Set buildTags to withdeploy to download the withdeploy version binary.
Hugo 0.170.0 dropped the extended edition, so extended is ignored for 0.170.0 and later.
For older Hugo versions, set buildTags to extended to download the extended version binary,
or extended,withdeploy for the extended withdeploy one.
If the requested build isn't available for the user's platform, then the normal version will be downloaded instead.
- Type:
string - Default:
"https://github.com"
Set it to your proxy URL to download the Hugo binary from a different download repository.
- Type:
string - Default: the version specified in package.json
You can override the Hugo version here. It must be a full version like 0.124.1, with or without a leading v. Please note that if any of the URLs have changed upstream, you might not be able to use
any version and you will probably need to update to a newer hugo-bin version which takes into consideration the new URLs.
See the package.json commit history.
MIT © Shun Sato