version: '2'

tasks:

# Setup web-mc
  setup:
    cmds:
      - echo 'Starting'
      - nodejs-setup

  # Find package.json and install node_modules
  nodejs-setup:
    deps: [node-installed]
    desc: Search for package.json and install listed node modules
    cmds:
      - npm install

  node-installed:
    desc: Check if nodejs is installed
    cmds:
      - node -v

version: '2'

tasks:

# Setup web-mc
  setup:
    cmds:
      - echo 'Starting'
      - hugo-installed
      - node-setup


  # Install node_modules
  node-setup:
    deps:
      - node_installed
    desc: Run npm install if node_modules doesn't exist
    cmds:
      - npm install
    status:
      - test -d node_modules

  # Check if node installed
  node_installed:
    silent: true
    cmds:
      - |
        if ! command -v node > /dev/null; then
          echo "node is not installed. aborting."
          exit 1
        fi
      - echo "node installed, ok."

  hugo-installed:
    silent: true
    cmds:
      - |
        if ! command -v hugo > /dev/null; then
          echo "hugo is not installed. aborting."
          exit 1
        fi
      - echo "hugo installed, ok."

Add tasks to check for hugo, node, node_modules
Add tasks to check for hugo, node, node_modules
