#!/usr/bin/env node /* gosh.js: launch bash script from any environment from within our package.json builds This script will try and locate the bash.exe executable that is included in Git for Windows on Windows platforms, and execute it within the current console. On *nix environments, it will simply launch /bin/bash. Usage: Make sure gosh is installed, e.g.: npm install '@keymanapp/resources-gosh@*' Then, in package.json, define scripts like this: "scripts": { "foo": "gosh ./foo.sh ..." } For example, in common/web/utils/package.json, npm run build is defined as: "build": "gosh ./build.sh -skip-package-install" Windows launch strategy: * If GIT_BASH_FOR_KEYMAN environment variable is defined, then this script will parse the variable to extract the bash executable, and then use the remaining components of the variable to launch the script with its parameters. * If GIT_BASH_FOR_KEYMAN is *not* defined, then the script looks in the Program Files and Program Files (x86) folders, Git/bin/bash.exe, (using the %ProgramFiles% and %ProgramFiles(x86)% environment variables) and appends the parameters: --init-file .../Git/etc/profile -l