-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchangeProjectsReferencesToRepo.sh
executable file
·27 lines (25 loc) · 1.59 KB
/
changeProjectsReferencesToRepo.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
#!/bin/bash
# example: ./changeVersionToPublish.sh 1.0.0
version=$(node -p -e "require('./package.json').version")
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
find . -path ./node_modules -prune -o -name "package.json" -type f | grep -v node_modules | grep -v example | while read file; do
echo "Updating $file with version $version"
sed -i '' "s/\"@hashgraph\/asset-tokenization-sdk\": \".*\"/\"@hashgraph\/asset-tokenization-sdk\": \"$version\"/g" "$file"
sed -i '' "s/\"@hashgraph\/asset-tokenization-contracts\": \".*\"/\"@hashgraph\/asset-tokenization-contracts\": \"$version\"/g" "$file"
done
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux
find . -path ./node_modules -prune -o -name "package.json" -type f | grep -v node_modules | grep -v example | while read file; do
echo "Updating $file with version $version"
sed -i "s/\"@hashgraph\/asset-tokenization-sdk\": \".*\"/\"@hashgraph\/asset-tokenization-sdk\": \"$version\"/g" "$file"
sed -i "s/\"@hashgraph\/asset-tokenization-contracts\": \".*\"/\"@hashgraph\/asset-tokenization-contracts\": \"$version\"/g" "$file"
done
elif [[ "$OSTYPE" == "msys" ]]; then
# Windows
find . -path ./node_modules -prune -o -name "package.json" -type f | grep -v node_modules | grep -v example | while read file; do
echo "Updating $file with version $version"
sed -i "s/\"@hashgraph\/asset-tokenization-sdk\": \".*\"/\"@hashgraph\/asset-tokenization-sdk\": \"$version\"/g" "$file"
sed -i "s/\"@hashgraph\/asset-tokenization-contracts\": \".*\"/\"@hashgraph\/asset-tokenization-contracts\": \"$version\"/g" "$file"
done
fi