{"id":13553561,"url":"https://github.com/small-tech/node-hugo","last_synced_at":"2025-04-28T22:30:58.551Z","repository":{"id":42861595,"uuid":"259699765","full_name":"small-tech/node-hugo","owner":"small-tech","description":"Provides a cross-platform interface to the Hugo binary from Node.js.","archived":false,"fork":false,"pushed_at":"2022-03-26T14:51:25.000Z","size":93,"stargazers_count":5,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-24T02:03:31.756Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/small-tech.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-28T17:00:34.000Z","updated_at":"2022-01-29T22:09:37.000Z","dependencies_parsed_at":"2022-09-05T20:22:07.380Z","dependency_job_id":null,"html_url":"https://github.com/small-tech/node-hugo","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/small-tech%2Fnode-hugo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/small-tech%2Fnode-hugo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/small-tech%2Fnode-hugo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/small-tech%2Fnode-hugo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/small-tech","download_url":"https://codeload.github.com/small-tech/node-hugo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251397576,"owners_count":21583034,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T12:02:28.288Z","updated_at":"2025-04-28T22:30:58.209Z","avatar_url":"https://github.com/small-tech.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","others"],"sub_categories":[],"readme":"# Node Hugo\n\nA basic cross-platform interface to the Hugo binary from Node.js that uses the 64-bit release binaries to support Linux, macOS, and Windows.\n\nIt should __just work™__\n\n## System requirements\n\nRuns on x64, arm, and arm64 on Linux, macOS, and Windows.\n\n## Installation\n\n```sh\nnpm i @small-tech/node-hugo\n```\n\n## Usage\n\n```js\nconst Hugo = require('@small-tech/node-hugo')\n\n(async function main () {\n\n  const optionalPathToHugoConfiguration = 'optional/path/to/hugo/configuration/'\n\n  const hugo = new Hugo()\n\n  // Run a build.\n  try {\n    await hugo.build(optionalPathToHugoConfiguration)\n  } catch (error) {\n    console.log('There was an error building the site with Hugo'. error)\n    return\n  }\n\n  console.log('Site build successful. Output:', hugo.output)\n\n  // Start Hugo server. Returns a ChildProcess instance.\n  const hugoServerProcess = hugo.createServer(optionalPathToHugoConfiguration)\n\n  hugoServerProcess.on('error', (error) =\u003e {\n    console.log('Hugo server encountered an error', error)\n  })\n\n  hugoServerProcess.stdout.on('data', (data) =\u003e {\n    console.log(`[Hugo] ${data}`)\n  })\n\n  hugoServerProcess.stderr.on('data', (data) =\u003e {\n    console.log(`[Hugo] [ERROR] ${data}`)\n  })\n\n  hugoServerProcess.on('close', (code) =\u003e {\n    console.log('Hugo server process exited with code', code)\n  })\n\n  // Close the server after 5 seconds.\n  setTimeout(() =\u003e {\n    hugoServerProcess.kill()\n  }, 5000)\n\n})()\n```\n\n__(Version 1.2.0+)__ You can also run any Hugo command using the simple pass-through `command()` method:\n\n```js\nconst Hugo = require('@small-tech/node-hugo')\n\n(async function main () {\n\n  const hugo = new Hugo()\n\n  try {\n    // Tell the built-in Hugo binary to create a new site at ./my-new-site/.\n    await hugo.command('new site my-new-site')\n  } catch (error) {\n    console.log('There was an error creating the new site with Hugo'. error)\n    return\n  }\n\n  console.log('Site build successful. Output:', hugo.output)\n})()\n```\n\n__(Version 1.3.0+)__ For creating Hugo servers with an arbitrary argument string, you can use the `serverWithArgs()` method. This works like the blocking `command()` method but provides streaming output from the Hugo server.\n\n__(Version 1.4.0+)__ You can retrieve the version of Hugo that’s bundled using the `version` property:\n\n```js\nconst Hugo = require('@small-tech/node-hugo')\nconst hugo = new Hugo()\nconsole.log(`Hugo version: ${hugo.version}`)\n```\n\n## Maintenance\n\n### Update Hugo binaries\n\nOn Linux-esque operating systems (with Bash shell):\n\n```sh\nnpm run update-hugo-bin\n```\n\nThis will remove the current binaries, download the latest ones, and rename them properly.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmall-tech%2Fnode-hugo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmall-tech%2Fnode-hugo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmall-tech%2Fnode-hugo/lists"}