#!/bin/bash

echo ========================== PLUGIN COMPILATION ==================================
cd chrome-extension/ 
npm install
export HOST_ADDR="localhost"
export PROTOCOL="http"
export NODE_ENV="development"

export PLUGIN_INFO=$(node -e 'console.log(JSON.stringify(require("./src/manifest.json")))')

npm run development
zip -r dist.zip ./dist
mv dist.zip ../dashboard/public
cd ..



cd chrome-extension/ 
export PLUGIN_INFO=$(node -e 'console.log(JSON.stringify(require("./src/manifest.json")))')
cd ..

echo "PLUGIN_INFO = $PLUGIN_INFO"

echo ========================== CONTAINER DOWN ==================================

docker-compose -f docker-compose.yml -f docker-compose.development.yml down -v

echo ========================== CONTAINER BUILDING ==================================

docker-compose -f docker-compose.yml -f docker-compose.development.yml up --build 
