Node.js Commands

This example demonstrates how to configure garden.shell to use node when running custom commands.

Examples

garden hello
garden info
# Pass additional arguments after the double-dash `--` end-of-options marker.
garden hello -- cat

garden.yaml

# Demo using "node" as the interpreter for custom commands.
garden:
  shell: node

commands:
  hello: |
    if (process.argv.length > 1) {
      console.log('hello ' + process.argv.slice(1).join(' '));
    } else {
      console.log('hello world')
    }

  info: |
    console.log(process)
    console.log('${uname}')

# NOTE: exec expressions are always run using the system's default #!/bin/sh shell.
variables:
  uname: $ uname -a