- Static compiler with STRC pattern (Static Template Resolution with
Compartmentalized Layers)
- Template syntax: { } interpolation, { s-for }, { s-if/s-elif/s-else
}
- File types: .strata, .compiler.sts, .service.sts, .api.sts, .sts,
.scss
- CLI tools: strata dev, strata build, strata g (generators)
- create-strata scaffolding CLI with Pokemon API example
- Dev server with WebSocket HMR (Hot Module Replacement)
- Documentation: README, ARCHITECTURE, CHANGELOG, CONTRIBUTING,
LICENSE
178 lines
5.1 KiB
Bash
Executable File
178 lines
5.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Strata Framework - Uninstall Script
|
|
# Usage: ./scripts/uninstall.sh [options]
|
|
# --keep-config Keep configuration files
|
|
# --force Skip confirmation prompt
|
|
# --help Show this help message
|
|
|
|
set -e
|
|
|
|
# Colors
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
CYAN='\033[0;36m'
|
|
NC='\033[0m'
|
|
BOLD='\033[1m'
|
|
|
|
# Directories
|
|
STRATA_HOME="${STRATA_HOME:-$HOME/.strata}"
|
|
LOCAL_BIN="/usr/local/bin"
|
|
|
|
# Options
|
|
KEEP_CONFIG=false
|
|
FORCE=false
|
|
|
|
# Parse arguments
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
--keep-config)
|
|
KEEP_CONFIG=true
|
|
shift
|
|
;;
|
|
--force|-f)
|
|
FORCE=true
|
|
shift
|
|
;;
|
|
--help|-h)
|
|
echo "Strata Framework - Uninstall Script"
|
|
echo ""
|
|
echo "Usage: ./scripts/uninstall.sh [options]"
|
|
echo ""
|
|
echo "Options:"
|
|
echo " --keep-config Keep configuration files in ~/.strata/config"
|
|
echo " --force, -f Skip confirmation prompt"
|
|
echo " --help Show this help message"
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo -e "${RED}Unknown option: $1${NC}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
print_step() {
|
|
echo -e "${BLUE}▶${NC} $1"
|
|
}
|
|
|
|
print_success() {
|
|
echo -e "${GREEN}✓${NC} $1"
|
|
}
|
|
|
|
print_warning() {
|
|
echo -e "${YELLOW}⚠${NC} $1"
|
|
}
|
|
|
|
# Confirmation prompt
|
|
if [ "$FORCE" = false ]; then
|
|
echo ""
|
|
echo -e "${YELLOW}╔═══════════════════════════════════════════════════════╗${NC}"
|
|
echo -e "${YELLOW}║ Strata Framework - Uninstall ║${NC}"
|
|
echo -e "${YELLOW}╚═══════════════════════════════════════════════════════╝${NC}"
|
|
echo ""
|
|
echo "This will remove:"
|
|
echo " - Strata binary from $STRATA_HOME/bin"
|
|
echo " - Shell completions from $STRATA_HOME/completions"
|
|
if [ "$KEEP_CONFIG" = false ]; then
|
|
echo " - Configuration from $STRATA_HOME/config"
|
|
fi
|
|
echo " - Global symlink from $LOCAL_BIN (if exists)"
|
|
echo " - Shell configuration (Strata block) from your shell rc file"
|
|
echo ""
|
|
read -p "Are you sure you want to uninstall Strata? [y/N] " -n 1 -r
|
|
echo ""
|
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
echo "Uninstall cancelled."
|
|
exit 0
|
|
fi
|
|
echo ""
|
|
fi
|
|
|
|
# Remove global symlink
|
|
print_step "Removing global symlink..."
|
|
if [ -L "$LOCAL_BIN/strata" ]; then
|
|
if [ -w "$LOCAL_BIN" ]; then
|
|
rm -f "$LOCAL_BIN/strata"
|
|
else
|
|
sudo rm -f "$LOCAL_BIN/strata"
|
|
fi
|
|
print_success "Removed $LOCAL_BIN/strata"
|
|
else
|
|
echo " No global symlink found"
|
|
fi
|
|
|
|
# Remove Strata home directory
|
|
print_step "Removing Strata installation..."
|
|
if [ -d "$STRATA_HOME" ]; then
|
|
if [ "$KEEP_CONFIG" = true ]; then
|
|
# Keep config, remove everything else
|
|
rm -rf "$STRATA_HOME/bin"
|
|
rm -rf "$STRATA_HOME/completions"
|
|
print_success "Removed $STRATA_HOME (kept config)"
|
|
else
|
|
rm -rf "$STRATA_HOME"
|
|
print_success "Removed $STRATA_HOME"
|
|
fi
|
|
else
|
|
echo " No installation found at $STRATA_HOME"
|
|
fi
|
|
|
|
# Clean up shell configuration
|
|
print_step "Cleaning shell configuration..."
|
|
|
|
clean_shell_config() {
|
|
local config_file="$1"
|
|
|
|
if [ ! -f "$config_file" ]; then
|
|
return
|
|
fi
|
|
|
|
# Check if Strata config exists
|
|
if ! grep -q "# Strata Framework" "$config_file"; then
|
|
return
|
|
fi
|
|
|
|
# Create backup
|
|
cp "$config_file" "${config_file}.backup.$(date +%Y%m%d%H%M%S)"
|
|
|
|
# Remove Strata block (from "# Strata Framework" to the next blank line after completions)
|
|
# This handles multi-line blocks
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
# macOS sed
|
|
sed -i '' '/# Strata Framework/,/^$/d' "$config_file"
|
|
else
|
|
# GNU sed
|
|
sed -i '/# Strata Framework/,/^$/d' "$config_file"
|
|
fi
|
|
|
|
print_success "Cleaned $config_file"
|
|
}
|
|
|
|
# Clean common shell config files
|
|
for config_file in "$HOME/.bashrc" "$HOME/.bash_profile" "$HOME/.zshrc" "$HOME/.profile"; do
|
|
clean_shell_config "$config_file"
|
|
done
|
|
|
|
# Fish config
|
|
if [ -f "$HOME/.config/fish/config.fish" ]; then
|
|
clean_shell_config "$HOME/.config/fish/config.fish"
|
|
fi
|
|
|
|
echo ""
|
|
echo -e "${GREEN}════════════════════════════════════════════════════════${NC}"
|
|
echo -e "${GREEN} Strata has been uninstalled ${NC}"
|
|
echo -e "${GREEN}════════════════════════════════════════════════════════${NC}"
|
|
echo ""
|
|
echo " Restart your terminal for changes to take effect."
|
|
echo ""
|
|
if [ "$KEEP_CONFIG" = true ]; then
|
|
echo " Your configuration was preserved at $STRATA_HOME/config"
|
|
echo ""
|
|
fi
|
|
echo " To reinstall Strata:"
|
|
echo -e " ${CYAN}./scripts/install.sh${NC}"
|
|
echo ""
|