LATE.IO2 / angular-fix-prod.sh
AIEONE
Initial commit syncing local server with Hugging Face Space
490ec84
#!/bin/bash
# Angular Project Structure Fixer
# Version 1.3 - Production Ready
# Fix component files
fix_angular_files() {
# Fix app.component.ts
local component_ts="src/app/app.component.ts"
if [ -f "$component_ts" ]; then
if ! grep -q 'templateUrl' "$component_ts"; then
echo "πŸ”„ Fixing app.component.ts"
cat > "$component_ts" <<EOF
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'agentic-dashboard';
}
EOF
fi
fi
# Fix app.component.html
local component_html="src/app/app.component.html"
if [ -f "$component_html" ]; then
if ! grep -q 'router-outlet' "$component_html"; then
echo "πŸ”„ Fixing app.component.html"
echo "<router-outlet></router-outlet>" > "$component_html"
fi
fi
}
# Safe file search function
check_project_structure() {
echo "πŸ” Checking project structure..."
find src \
-name "*.ts" -o \
-name "*.html" -o \
-name "*.css" \
-not -path "src/app/*" \
-not -path "*/environments/*" \
-not -path "*/node_modules/*" \
-not -path "*/dist/*" \
-print0 | xargs -0 -I {} sh -c 'echo "⚠️ Found file in non-standard location: {}"'
}
# Main execution
echo "πŸš€ Starting Angular project fix..."
fix_angular_files
check_project_structure
echo "βœ… All fixes applied"
echo "Running production build..."
ng build --configuration=production --project=agentic-dashboard
echo "Next steps:"
echo "1. Check build output above"
echo "2. Deploy files from dist/ directory"
echo "3. Configure server routing for Angular"