#!/usr/bin/env bash
rm -rf src/fallbacks
./scripts/fetchGraphQLFallbacks.sh > /dev/null
git status -s --untracked-files=all | cut -c4- | grep "src/fallbacks" > /dev/null
if [ $? = "1" ]; then
    echo "GraphQL Fallbacks up to date!"
    exit 0
else
    echo "ERROR! These GraphQL fallbacks are missing, outdated or unused:"
    git status -s --untracked-files=all | cut -c4- | grep "src/fallbacks"
    echo
    echo "You can fix this issue by running:"
    echo "  yarn workspace @kiwicom/smart-faq relay-fallbacks"
    echo "and commiting & pushing the changes to your branch"
    exit 1
fi
