#!/usr/bin/env bash
set -e

YELLOW='\033[0;33m'
CYAN='\033[0;36m'
RESET='\033[0m' # No Color

echo -e "${YELLOW}[TypeScript Typecheck] ${CYAN}Step (1): Typechecking stories${RESET}"
npx tsc --listEmittedFiles -p .

echo -e "${YELLOW}[TypeScript Typecheck] ${CYAN}Step (2): Typechecking packages${RESET}"
npx lerna exec --parallel -- 'if [ -f "tsconfig.json" ]; then echo "Typechecking"; npx tsc --listEmittedFiles -p ./tsconfig.json; fi'
