Official Node.js wrapper for Hugo binary management?

Just throwing this out into the ether as a feature that I think would be nice - not as a priority or a need, more of a “this could be nice”.

Currently Hugo package management is brew on Mac, snap on linux, and nothing on Windows. As there is a great active core dev team at the moment, I (as lowly windows user on the verge taking the leap to linux) often find myself deleting, downloading, extracting to get access to etc.

While that really is not hard, it might nice to have an official node wrapper to manage hugo’s binary installs - versioning (extended or otherwise), easy updating, possibly even other features I can’t think of like dockerfile setups or something - from the command line using npm.

Sort of a universal package manager for Hugo installs - if that makes sense.

I am aware of this repo: https://github.com/fenneclab/hugo-bin - but that seems a a few releases behind.

And I do realise I am being selfish since I don’t have the chops to chip in myself.

Just a thought. Have a great day.

First, there are several “Windows package managers” with Hugo. Scoop seems to be closest to Brew on macOS, and is updated with the latest Hugo:

It doesn’t provide the “extended version”, but that should be fixable.

I have to concerns with your suggestion:

  1. It somehow requires to run hugo via Node.js. This has its downsides and only make sense if you have hugo as part of a bigger node based workflow. Using it just to “get hugo” gives you the downsides, but very few upsides.
  2. Managing an “official hugo-bin” or whatever you call it is a fair amount of work. We’re not staffed to do it, esp. if you consider 1).
2 Likes

Scoop link added here:

2 Likes

Windows has chocolatey not sure if it can do what you are looking for though.

Strikes me that scoop is like a poor man’s chocolatey. Oddly enough it is also rather like a poor-man’s npm.

I don’t see that it would be that difficult to build an npm-based installer and runner for Hugo. I already have a package.json file (npm’s configuration file) for running Hugo server, building a site and building a template. I did start to try to create a script to download the latest version of Hugo from GitHub as well but then the format changed somewhat and it broke the script so possibly not so sustainable.

Happy to share the package.json though anyone who has ever used npm would easily be able to create their own.

So my take on this is that we need a Node.JS, cross-platform script that takes parameters to download the latest version but we would also need an agreed folder layout so that everything works in a consistent way.

Happy to coordinate something if there was enough interest but I’m afraid I’ve too many projects running to take on developing the script.

Here is my package.json in case anyone is interested. I’m just using npm as a task runner.

{
  "name": "itblog",
  "version": "1.0.1",
  "description": "Julian Knight's IT Blog (Much Ado About IT)",
  "scripts": {
    "start": "C:/src/Hugo/bin/hugo.exe server -D --disableFastRender",
    "build": "C:/src/Hugo/bin/hugo",
    "build-theme": "cd ./themes/twenty-sixteen; C:/src/Hugo/bin/hugo",
    "hugo-version": "C:/src/Hugo/bin/hugo version",
    "test": "echo \"No tests available\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git+ssh://git@gitlab.com/TotallyInformation/itblog.git"
  },
  "keywords": [
    "Hugo"
  ],
  "author": "Julian Knight (Totally Information)",
  "license": "MIT",
  "bugs": {
    "url": "https://gitlab.com/TotallyInformation/itblog/issues"
  },
  "homepage": "https://gitlab.com/TotallyInformation/itblog#README",
  "dependencies": {
    "scrape-twitter": "^0.11.0",
    "bulma": "^0.7.1"
  }
}

As you will see, all my dev files live under the C:\src folder. Hugo sites live under c:\src\Hugo which also contains the bin folder. twenty-sixteen is my theme and it uses the Bulma CSS framework.

Just checked and Chocolatey has Hugo 0.48 already so someone is maintaing that.

1 Like

Chocolatey status updated too.

1 Like

Oops. Didn’t notice before that there was an arrow to expand that card. Sorry about that.