-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathgenerate_report.sh
More file actions
executable file
·50 lines (43 loc) · 1.72 KB
/
generate_report.sh
File metadata and controls
executable file
·50 lines (43 loc) · 1.72 KB
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
#!/usr/bin/env bash
# Name of the output file
OUTPUT_FILE="repo_report.txt"
# Clean up any existing output file
rm -f "$OUTPUT_FILE"
#######################################
# 1. Generate and append repo structure
#######################################
echo "====================================" >> "$OUTPUT_FILE"
echo " REPO STRUCTURE " >> "$OUTPUT_FILE"
echo "====================================" >> "$OUTPUT_FILE"
# Use `tree` to list directory structure.
# -a : show hidden files
# -I : ignore patterns (regex-like)
# Here we add patterns to ignore:
# - node_modules, package-lock.json, various image files, .DS_Store,
# - .git (git logs), abis (the contract src/abis folder), and
# - main.0d424902.js (the unwanted file)
tree -a \
-I "node_modules|package-lock.json|*.ico|*.png|*.jpg|*.jpeg|*.svg|*.gif|.DS_Store|.git|abis|main.0d424902.js" \
. >> "$OUTPUT_FILE" 2>/dev/null
#######################################
# 2. Append contents of important files
#######################################
echo -e "\n\n====================================" >> "$OUTPUT_FILE"
echo " FILE CONTENTS " >> "$OUTPUT_FILE"
echo "====================================" >> "$OUTPUT_FILE"
# Find files with specific extensions
find . \
-type f \
\( -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" -o -name "*.sh" -o -name "*.json" \) \
-not -path "*node_modules*" \
-not -path "*.next*" \
-not -name "package-lock.json" \
-not -name "pnpm-lock.yaml" \
-not -name "yarn.lock" \
-not -path "*/.git/*" \
-print | while read -r file
do
echo -e "\n-------- $file --------" >> "$OUTPUT_FILE"
cat "$file" >> "$OUTPUT_FILE"
done
echo -e "\nDone! Report generated in '$OUTPUT_FILE'."