-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodemod.sh
32 lines (22 loc) · 840 Bytes
/
codemod.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
#!/bin/bash
echo "Executing codemod..."
MODULE=sdk
OLDNAME=hydra-sdk
NEWNAME=sdk
MOD_FOLDER=./modules/$MODULE
# Change package name to add scope
for DIR in ./modules/* ; do
echo "$DIR"
sed -i "s|$OLDNAME|@hydraprotocol/$NEWNAME|g" $DIR/package.json
done
sed -i "s|$OLDNAME|@hydraprotocol/$NEWNAME|g" ./app/package.json
# Change import statements
echo "Attempting to change imports"
find . \( -name '*.tsx' -o -name '*.ts' \) -type f -exec sed -i "s|from \"$OLDNAME|from \"@hydraprotocol/$NEWNAME|g" {} + \
# Change require statements
echo "Attempting to change require"
find . \( -name '*.js' \) -type f -exec sed -i "s|require(\"$OLDNAME|require(\"@hydraprotocol/$NEWNAME|g" {} + \
# Change turbo.json
echo "Attempting to change turbo.json"
sed -i "s|$OLDNAME|@hydraprotocol/$NEWNAME|g" ./turbo.json
echo "Codemod Executed"