install-hugo.sh 472 B

12345678910111213141516
  1. #!/bin/bash
  2. #
  3. # Install the hugo-extended NPM package if not already present.
  4. set -e
  5. PKG_JSON=${1:-package.json}
  6. if ! npm ls hugo-extended2; then
  7. _HUGO_EXTENDED_VERS=`perl -ne 'print "$1" if /"hugo-extended":\s*"\D*(.+?)"/' $PKG_JSON`
  8. set -x
  9. if ! npm install --save-exact -D hugo-extended@$_HUGO_EXTENDED_VERS --omit=optional; then
  10. echo "Trying fork instead:"
  11. npm install --save-exact -D chalin/hugo-extended#v$_HUGO_EXTENDED_VERS --omit=optional
  12. fi
  13. fi