Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
hugo-installer
Advanced tools
Installs Hugo into your repository.
Hugo is one of the most popular static site generators. In the world of web development we usually choose npm as our dependency management solution. Hugo, however, is written in Go - and thus not integrated into the npm module ecosystem. Instead, users are asked to install Hugo globally on their systems. Suboptimal, really.
But don't you worry, Hugo Installer is here to help! It's a small Node.js script which you can use to fetch the correct Hugo binary for
your system, e.g. via a postinstall
hook within a package.json
file. Neat!
Features include:
You can get the hugo-installer via npm by adding it as a new devDependency to your package.json
file and running
npm install
. Alternatively, run the following command:
npm install hugo-installer --save-dev
We recommended to use hugo-installer as part of your postinstall
hook within your project's package.json
file.
The Hugo version can be set using the --version
CLI parameter. For example:
{
"scripts": {
"postinstall": "hugo-installer --version 0.82.0"
}
}
Important: Make sure to use the exact version number as used in the official Hugo GitHub releases (e.g. trailing zeros that exist or do not exist)
You can also use the extended version of Hugo (for some operating systems!) by specifying the --extended
CLI parameter. For example:
{
"scripts": {
"postinstall": "hugo-installer --version 0.46 --extended"
}
}
Bonus tip: The --version
CLI parameter can also be an object path to some value defined in your package.json
file. This allows for the
Hugo version to be configured someplace else, e.g. in a otherDependencies
object. For example:
{
"otherDependencies": {
"hugo": "0.46"
},
"scripts": {
"postinstall": "hugo-installer --version otherDependencies.hugo"
}
}
The following lists all available CLI parameters and their respective default values. Only the --version
CLI parameter is required.
CLI parameter | Description |
---|---|
--arch [arch] | System architecture that the binary will run on. It is recommended to use auto-detect by not using this option. → Default value: Auto-configured on runtime using os.arch() |
--destination [path] | Path to the folder into which the binary will be put. Make sure to add this path to your .gitignore file.→ Default value: bin/hugo |
--downloadUrl [url] | Source base URL from where the Hugo binary will be fetched. By default, GitHub will be used. When using a custom URL, make sure to replicate GitHub release asset URLs and append a trailing slash to the custom URL. → Default value: https://github.com/gohugoio/hugo/releases/download/ |
--extended | Download the extended version of Hugo. → Default value: false |
--force | Force clean install of Hugo, ignoring already installed / cached binaries. → Default value: false |
--os [os] | Operating system that the binary should run on. It is recommended to use auto-detect by not using this option. → Default value: Auto-configured on runtime using os.platform() |
--skipChecksumCheck | Skip checksum checks for downloaded binaries. It is recommended to leave this option enabled. → Default value: true |
--skipHealthCheck | Skip health checks for downloaded binaries. It is recommended to leave this option enabled. → Default value: true |
--version [version] | Hugo version to install, or path to package.json entry with the version. Make sure to use the exact version number as defined in the official Hugo GitHub releases. |
You can always take a look at all available CLI parameters using the --help
CLI parameter. For example:
hugo-installer --help
Once fetched, the hugo binary can be used directly from your favourite command line or as part of an npm script. For example:
bin/hugo/hugo --config=hugo.config.json
One might also want to integrate Hugo in a NodeJS build script, or a NodeJS-based build tool such as Gulp. You
can execute the Hugo binary using the Node.JS spawn
function. For example:
const path = require('path');
const spawn = require('child_process').spawn;
// Use Hugo
spawn(path.resolve(process.cwd(), 'bin', 'hugo', 'hugo'), [`--config=hugo.config.json`], {
stdio: 'inherit',
}).on('close', () => {
// Callback
});
FAQs
Installs hugo into your repository.
The npm package hugo-installer receives a total of 2,883 weekly downloads. As such, hugo-installer popularity was classified as popular.
We found that hugo-installer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.