Giter VIP home page Giter VIP logo

hugo-cli's Introduction

hugo-cli

CI

A simple Node wrapper around hugo, the static site generator. It fetches the right hugo executable before piping all provided command line arguments to it.

Usage

$ npx hugo-cli -h
INFO hugo not found. Attempting to fetch it...
INFO fetched hugo v0.104.3
INFO extracting archive...
INFO hugo available, let's go!

hugo is the main command, used to build your Hugo site.

Hugo is a Fast and Flexible Static Site Generator
built with love by spf13 and friends in Go.

Complete documentation is available at http://gohugo.io/.

Usage:
  hugo [flags]
  hugo [command]

...

Download specific hugo version

If you want to download a specific hugo version, you can set HUGO_VERSION env before you run the command.

$ HUGO_VERSION=0.64.0 npx hugo-cli version
$ HUGO_VERSION=0.64.0/extended npx hugo-cli version

Integrations

Add to your build scripts in package.json to build you site from NodeJS:

  ...
  "scripts": {
    "build": "hugo"
  },
  "dependencies": {
    "hugo-cli": "*"
  },
  ...

Execute directly via npx:

npx hugo-cli server

License

MIT

hugo-cli's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hugo-cli's Issues

Unable to specify extended version or alternate version

I am unable to specify the required hugo version to be installed. Kindly let me know where this can be done. Tried mentioning the process.env.HUGO_VERSION=extended_0.53.0 in process.env file.

I am using yarn for js package dependency.

Fails on windows

Error: spawn C:\Users\AndrΓ© Zensen\Desktop\bpmn-js-doc\docs.bpmn.io\no
de_modules\hugo-cli\tmp\hugo_0.14_windows_amd64\hugo_0.14_windows_amd64.exe.exe
ENOENT
    at exports._errnoException (util.js:870:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
    at onErrorNT (internal/child_process.js:344:16)
    at nextTickCallbackWith2Args (node.js:442:9)
    at process._tickCallback (node.js:356:17)

The hugo is not building the assets files (scss, js)

I'm using hugo 0.75.1 version on ubuntu 20

Using that to run:

HUGO_VERSION=0.75.1 node_modules/.bin/hugo serve --environment development

I change a scss file and it don't generate the resources file, but if I run the hugo build that is installed on my system it generates

> 0.17 download names are in a different format

When trying to use a specific version of hugo, the download fails (404 - downloads the html) on version 0.17 and above.

This is because hugo-cli looks for hugo_${version}_${platform}_${arch} e.g. hugo_0.17_darwin_amd64.zip but the actual filename is hugo_0.17_MacOS-64bit.zip

fresh install run error events.js:160

already tried to install on another directory, restart the computer but still met an error, here the environment and step i took
$ node -v
v6.11.2
$ npm -v
3.10.10
$ cd ~/hugo
$ npm install hugo-cli
$ node_modules/.bin/hugo -h
hugo not downloaded yet. attempting to grab it...
fetched hugo v0.30.2
extracting archive...
we got it, let's go!

events.js:160
throw er; // Unhandled 'error' event
^

Error: spawn /Users/sugizo/hugo/node_modules/hugo-cli/tmp/hugo_0.30.2_darwin_amd64 ENOENT
at exports._errnoException (util.js:1020:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)

Hugo binary extraction is not within a folder on Windows

When extracting the Windows binary, it is not stored within a folder like the Mac version.

For example on Mac:

tmp/hugo_0.18.1_macOS-64bit.zip
// extracts to...
tmp/hugo_0.18.1_darwin_amd64/hugo_0.18.1_darwin_amd64

On Windows:

tmp/hugo_0.18.1_Windows-64bit.zip
\\ extracts to...
tmp/hugo_0.18.1_windows_amd64.exe

PR to follow...

How to run with specific version in grunt?

Hello, I'm trying to setup hugo-cli to use a specific version (the latest extended version) via a grunt-exec script but any time I do that I get an error:

>> 'HUGO_VERSION' is not recognized as an internal or external command,
>> operable program or batch file.
>> Exited with code: 1.
>> Error executing child process: Error: Command failed: HUGO_VERSION=extended_0.64.0 npx hugo-cli
>> 'HUGO_VERSION' is not recognized as an internal or external command,
>> operable program or batch file.

I think I have found that if I run it like this in a standard command prompt (via the below commands) it works, but I am unable to get this to work via grunt no matter the combinations I try.

> set HUGO_VERSION=extended_0.64.0
> npx hugo-cli

This is a windows machine.

Thanks!

Hugo >= 0.54.0 not be able to download

Hey,

since hugo 0.54.0 they changed the download link in github. So it is not possible to use hugo-cli for this version. Is it possible to use the current version with a flag or setting or do we need an updated version of the cli?

0.54.0: github.com/gohugoio/hugo/releases/download/v0.54.0/hugo_extended_0.54.0_macOS-64bit.tar.gz
0.53.0: github.com/gohugoio/hugo/releases/download/v0.53/hugo_extended_0.53_macOS-64bit.tar.gz

error on windows

I have a clean install of windows and after installing hugo-cli globally, I get this error:

Error: unknown command "C:\Program Files\nodejs\node.exe" for "hugo"
Run 'hugo --help' for usage.

Module doesn't work on M1 Macbook due to incorrect architecture & URL

Describe the Bug

hugo-cli doesn't work when being invoked on an M1 Macbook pro

Steps to Reproduce

Full stack trace
test@test-mac sensu-docs % yarn
yarn install v1.22.19
info No lockfile found.
[1/5] πŸ”  Validating package.json...
[2/5] πŸ”  Resolving packages...
warning cssnano > cssnano-preset-default > postcss-svgo > [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
warning cssnano > cssnano-preset-default > postcss-svgo > svgo > [email protected]: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
warning node-sass > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning node-sass > request > [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
warning node-sass > request > [email protected]: this library is no longer supported
[3/5] 🚚  Fetching packages...
[4/5] πŸ”—  Linking dependencies...
[5/5] πŸ”¨  Building fresh packages...
success Saved lockfile.
$ grunt
Running "env:dev" (env) task
Running "env:dev" (env) task
Running "print-hugo-version" task
INFO hugo not found. Attempting to fetch it...
ERROR failed to download hugo: HTTPError: Response code 404 (Not Found)
failed to grab hugo :-(
GotError [HTTPError]: Response code 404 (Not Found)
    at EventEmitter.<anonymous> (/Users/test/sensu-docs/node_modules/got/source/as-stream.js:35:24)
    at EventEmitter.emit (node:events:513:28)
    at module.exports (/Users/test/sensu-docs/node_modules/got/source/get-response.js:22:10)
    at ClientRequest.handleResponse (/Users/test/sensu-docs/node_modules/got/source/request-as-event-emitter.js:155:5)
    at Object.onceWrapper (node:events:628:26)
    at ClientRequest.emit (node:events:525:35)
    at origin.emit (/Users/test/sensu-docs/node_modules/@szmarczak/http-timer/source/index.js:37:11)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:693:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:117:17)
    at TLSSocket.socketOnData (node:_http_client:534:22) {
  host: 'github.com',
  hostname: 'github.com',
  method: 'GET',
  path: '/gohugoio/hugo/releases/download/v0.101.0/hugo_0.101.0_macOS_ARM.tar.gz',
  socketPath: undefined,
  protocol: 'https:',
  url: 'https://github.com/gohugoio/hugo/releases/download/v0.101.0/hugo_0.101.0_macOS_ARM.tar.gz',
  gotOptions: {
    path: '/gohugoio/hugo/releases/download/v0.101.0/hugo_0.101.0_macOS_ARM.tar.gz',
    protocol: 'https:',
    slashes: true,
    auth: null,
    host: 'github.com',
    port: null,
    hostname: 'github.com',
    hash: null,
    search: null,
    query: null,
    pathname: '/gohugoio/hugo/releases/download/v0.101.0/hugo_0.101.0_macOS_ARM.tar.gz',
    href: 'https://github.com/gohugoio/hugo/releases/download/v0.101.0/hugo_0.101.0_macOS_ARM.tar.gz',
    retry: {
      retries: [Function (anonymous)],
      methods: [Set],
      statusCodes: [Set],
      errorCodes: [Set]
    },
    headers: {
      'user-agent': 'got/9.6.0 (https://github.com/sindresorhus/got)',
      'accept-encoding': 'gzip, deflate'
    },
    hooks: {
      beforeRequest: [],
      beforeRedirect: [],
      beforeRetry: [],
      afterResponse: [],
      beforeError: [],
      init: []
    },
    decompress: true,
    throwHttpErrors: true,
    followRedirect: true,
    stream: true,
    form: false,
    json: false,
    cache: false,
    useElectronNet: false,
    method: 'GET'
  },
  statusCode: 404,
  statusMessage: 'Not Found',
  headers: {
    server: 'GitHub.com',
    date: 'Mon, 17 Oct 2022 14:08:22 GMT',
    'content-type': 'text/plain; charset=utf-8',
    vary: 'X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Encoding, Accept, X-Requested-With',
    'cache-control': 'no-cache',
    'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
    'x-frame-options': 'deny',
    'x-content-type-options': 'nosniff',
    'x-xss-protection': '0',
    'referrer-policy': 'no-referrer-when-downgrade',
    'expect-ct': 'max-age=2592000, report-uri="https://api.github.com/_private/browser/errors"',
    'content-security-policy': "default-src 'none'; base-uri 'self'; connect-src 'self'; form-action 'self'; img-src 'self' data:; script-src 'self'; style-src 'unsafe-inline'",
    'content-encoding': 'gzip',
    'content-length': '29',
    'x-github-request-id': 'CA67:6C99:E82772:15F08B2:634D61D6',
    connection: 'close'
  },
  body: undefined
}
Fatal error: Error
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

% uname -a

Darwin mac 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:19:52 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T6000 arm64

Expected Behavior

arch_exec and arch_dl should be able to ascertain the difference between ARM and ARM64

Environment

  • Host (Browser/Node version), if applicable: [e.g. MS Edge 18, Chrome 69, Node 10 LTS]: Node 18
  • OS: [e.g. Windows 7]: MacOS/M1 Macbook
  • Library version: [e.g. 2.0.0] 0.11.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.