Skip to content

Commit 379ad0c

Browse files
committed
sets typescript to latest known version for all projects
1 parent 6c09a0c commit 379ad0c

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

set-all-typescript-prs.sh

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
stableVersion="<5.7.0"
3+
4+
remote_name="origin"
5+
cd ..
6+
for item in *; do
7+
if [[ -d "$item" ]]; then
8+
cd "${item}" || exit
9+
echo "---*** Setting stable typescript $stableVersion PRs in project $item ***---"
10+
if git ls-remote --exit-code --heads "$remote_name" "master"; then
11+
master_branch="master"
12+
fi
13+
if git ls-remote --exit-code --heads "$remote_name" "main"; then
14+
master_branch="main"
15+
fi
16+
if [ -n "${master_branch}" ]; then
17+
git checkout "${master_branch}"
18+
fi
19+
git pull
20+
git fetch -p
21+
for branch_name in $(git branch -r | grep -v '\->' | sed 's/origin\///' | grep -v 'master' | grep -v 'main' | grep -v 'migration-to-kotlin' | grep -v '1.0.0-eol-continuous-release-branch-recovered' | grep -v 'migrate-to-kotlin'); do
22+
echo "Processing branch: $branch_name"
23+
if [ -n "${master_branch}" ]; then
24+
git checkout "${branch_name}"
25+
git pull
26+
git merge origin/"${master_branch}" --no-edit
27+
find . -name "package.json" -not -path "*/node_modules/*" | while read -r file; do
28+
echo "Processing $file"
29+
sed -i.bak -E 's/"typescript":\s*"<?~?([0-9]+\.)?([0-9]+\.)?[0-9]+"/"typescript": "'$stableVersion'"/' "$file"
30+
echo "Updated $file"
31+
done
32+
find . -name "package.json.bak" -not -path "*/node_modules/*" -delete
33+
git add .
34+
git commit -am "Typescript Update to $stableVersion"
35+
git push
36+
gh pr merge $(gh pr list --base "${master_branch}" --head "${branch_name}" --json number --jq '.[0].number' | xargs echo) --auto --merge
37+
git checkout "${master_branch}"
38+
fi
39+
done
40+
cd ..
41+
fi
42+
done
43+
cd project-signer || exit

setTypescriptVersion.sh

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ for branch_name in $(git branch -r | grep -v '\->' | sed 's/origin\///' | grep -
2626
echo "Updated $file"
2727
done
2828
find . -name "package.json.bak" -not -path "*/node_modules/*" -delete
29+
git add .
30+
git commit -am "Typescript Update to $stableVersion"
2931
git push
3032
gh pr merge $(gh pr list --base "${master_branch}" --head "${branch_name}" --json number --jq '.[0].number' | xargs echo) --auto --merge
3133
git checkout "${master_branch}"

0 commit comments

Comments
 (0)