File size: 1,676 Bytes
490ec84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/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"