Enterprise-CMCS/macpro-mako

View on GitHub
run

Summary

Maintainability
Test Coverage
#!/bin/bash

set -eu -o pipefail

# this is the entrypoint for development. It wraps up compiling and calling run.ts
# all arguments, changes, etc. should be found in src/run.ts

if ! which direnv > /dev/null ; then
    echo "direnv not found on the system. See installation and setup instructions at https://direnv.net/"
    exit 1
fi

# check node exists
if ! which node > /dev/null ; then
    echo "node not found on the system. Install version in .nvmrc based on instructions in README"
    exit 1
fi

# check node version
if ! diff  <(cat .nvmrc | tr -d '\n') <(node -v | tr -d '\n') > /dev/null ; then
    echo "node version does not match the version required in .nvmrc"
    echo "If using nvm, run 'nvm use'"
    exit 1
fi

# check bun exists
if ! which bun > /dev/null ; then
    echo "bun not found on the system. On macOS, you can install it with 'brew install oven-sh/bun/bun'"
    exit 1
fi

# Ensure packages are up to date.
bun install

# build and run dev.ts
bun build:cli && node ./.build_run/src/run.js "$@"