feat: migrate Bash builder script to node.js for enhanced cross-platform compatibility

This commit is contained in:
Mathias Schopmans
2024-03-06 14:20:30 +01:00
committed by Mathias Schopmans
parent b7efe8060f
commit 7ed4ca9eb2
3 changed files with 109 additions and 48 deletions

View File

@@ -1,46 +0,0 @@
#!/bin/bash
CWD=$(pwd)
BUILDER_DIR="$CWD/.techradar"
SOURCE_DIR="$CWD/node_modules/aoe_technology_radar"
PARAMETER=$1 # "build" or "serve"
function info {
echo -e "\033[32m$1\033[0m"
}
function error {
echo "Error: $1"
exit 1
}
# create builder dir by copying source dir if it does not exist
if [ ! -d "$BUILDER_DIR" ]; then
cp -R "$SOURCE_DIR" "$BUILDER_DIR" || error "Could not copy $SOURCE_DIR to $BUILDER_DIR"
cd "$BUILDER_DIR" || error "Could not change to $BUILDER_DIR"
info "Installing npm packages"
npm install || error "Could not install npm packages"
fi
cp -R "$CWD/radar" "$BUILDER_DIR/data/radar" || error "Could not copy $CWD/radar to $BUILDER_DIR/data/radar"
cp -R $CWD/public/* "$BUILDER_DIR/public/" || error "Could not copy $CWD/public to $BUILDER_DIR/public"
cd "$BUILDER_DIR" || error "Could not change to $BUILDER_DIR"
info "Building data"
npm run build:data
if [ "$PARAMETER" == "serve" ]; then
info "Starting techradar"
npm run dev
fi
if [ "$PARAMETER" == "build" ]; then
info "Building techradar"
npm run build
if [ -d "$CWD/build" ]; then
rm -rf "$CWD/build"
fi
info "Copying techradar to $CWD/build"
mv "$BUILDER_DIR/out" "$CWD/build"
fi