Skip to content
Hyas Docs
GitHubTwitterMastodon

Upgrade to Hyas v2

This guide will walk you through the steps to manually migrate from Hyas v1 to Hyas v2.

Upgrading

You can upgrade your project by following the steps below.

1. Clean dependencies

Clean dependencies currently installed to avoid conflicts.

npm run clean:install

2. Update package.json

Replace the contents of your project’s package.json with the following:

{
  "name": "hyas",
  "version": "0.0.0",
  "author": "Hyas",
  "license": "MIT",
  "scripts": {
    "dev": "exec-bin node_modules/.bin/hugo/hugo server --bind=0.0.0.0 --disableFastRender --baseURL=http://localhost --noHTTPCache",
    "dev:drafts": "exec-bin node_modules/.bin/hugo/hugo server --bind=0.0.0.0 --disableFastRender --baseURL=http://localhost --noHTTPCache --buildDrafts",
    "create": "exec-bin node_modules/.bin/hugo/hugo new",
    "lint": "npm run lint:scripts && npm run lint:styles && npm run lint:markdown",
    "lint:scripts": "eslint --cache config",
    "lint:styles": "stylelint --cache \"assets/scss/**/*.{css,sass,scss}\"",
    "lint:markdown": "markdownlint-cli2 \"*.md\" \"content/**/*.md\"",
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "exec-bin node_modules/.bin/hugo/hugo --minify",
    "preview": "http-server --gzip --brotli --ext=html --cors",
    "clean": "npm run clean:build && npm run clean:lint && npm run clean:install",
    "clean:build": "shx rm -rf public resources .hugo_build.lock",
    "clean:install": "shx rm -rf node_modules package-lock.json yarn.lock pnpm-lock.yaml",
    "clean:lint": "shx rm -rf .eslintcache .stylelintcache",
    "preinfo": "npm version",
    "info": "npm list",
    "postinfo": "exec-bin node_modules/.bin/hugo/hugo version",
    "postinstall": "shx rm -rf node_modules/.bin/hugo && shx mkdir node_modules/.bin/hugo && shx cp node_modules/gethyas/node_modules/.bin/hugo/* node_modules/.bin/hugo"
  },
  "engines": {
    "node": ">=16.12.0"
  }
}

3. Install Hyas and integrations

First, add an .npmrc file to your project root with the following:

enable-pre-post-scripts = true
auto-install-peers = true
node-linker = hoisted
prefer-symlinked-executables = false

Next, install the latest version of Hyas and the recommended integrations in your project.

# Install Hyas v2.x
npm install gethyas@latest

# Recommended: install Bootstrap, Images, and SEO integrations
npm install @hyas/bootstrap@latest @hyas/images@latest @hyas/seo@latest

Configuration

Update your configuration files for the recommended integrations:

Know Issues

ENOENT

When you get an ENOENT error message, run the following command:

npm run clean:install && npm install