Skip to content
Source
Sign inSign up
TanStack/cli
Open History to see the last commit

check-for-ejs-duplicates.sh

29 lines767 Bytes

1#!/bin/bash
2​
3# Usage: ./scripts/check-for-ejs-duplicates.sh <directory>
4# Examples:
5# ./scripts/check-for-ejs-duplicates.sh frameworks/react-cra
6# ./scripts/check-for-ejs-duplicates.sh frameworks/solid
7​
8# Check if directory parameter is provided
9if [ -z "$1" ]; then
10 echo "Usage: $0 <directory>"
11 exit 1
12fi
13​
14# The directory to search in
15DIR="$1"
16​
17# Find all files that do NOT have .ejs extension
18find "$DIR" -type f ! -name "*.ejs" | while read -r file; do
19 # Get the directory and filename
20 file_dir=$(dirname "$file")
21 file_name=$(basename "$file")
23 # Check if a .ejs version exists in the same directory
24 ejs_file="${file_dir}/${file_name}.ejs"
26 if [ -f "$ejs_file" ]; then
27 echo "Found matching pair: $file has corresponding $ejs_file"
28 fi
29done