#!/bin/bash

if [ ! -d src/winbox-with-interactjs/node_modules ] ; then
    echo "Failed to find src/winbox-with-interactjs/node_modules" >&2
    echo "Have you run ./NPM-DEV-INSTALL.sh ?" >&2
    exit 1
fi
   
cd src/winbox-with-interactjs \
    && echo "Running npm run build in src/winbox-with-interactjs" \
    && npm run build \
    && echo "Copying build dist to winbox-with-interactjs-dist" \
    && /bin/rm -rf ../../winbox-with-interactjs-dist \
    && /bin/cp -r dist ../../winbox-with-interactjs-dist


if [ $? = 0 ] ; then
    echo ""
    echo "----"
    echo "Now run:"
    echo "  ./RSYNC-INSTALL-TABLETOP-DL.sh"
    echo "----"
    echo ""

fi
	   
