-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConvertTypeScript.sh
40 lines (28 loc) · 959 Bytes
/
ConvertTypeScript.sh
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
Path="src/lib"
# get names of files in path
for entry in "$Path"/*; do
# echo "$entry"
# Loop through all folders in path
if [ -d "$entry" ]; then
# echo "Directory"
for folder in "$entry"/*; do
# echo "$folder"
# Loop through all files in folder
for file in "$folder"/*; do
echo "$file"
# Convert file to tsx extension
if [[ $file == *.jsx ]]; then
echo "jsx file"
echo "converting $file"
echo "to $file.tsx"
# remove .jsx extension
filename=$(basename "$file" .jsx)
# add .tsx extension
newfilename=$filename.tsx
# rename file
mv "$file" "$folder/$newfilename"
fi
done
done
fi
done