Skip to content

Commit

Permalink
sets typescript to latest known version for all projects
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperancinha committed Jan 12, 2025
1 parent 6c09a0c commit 379ad0c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
43 changes: 43 additions & 0 deletions set-all-typescript-prs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
stableVersion="<5.7.0"

remote_name="origin"
cd ..
for item in *; do
if [[ -d "$item" ]]; then
cd "${item}" || exit
echo "---*** Setting stable typescript $stableVersion PRs in project $item ***---"
if git ls-remote --exit-code --heads "$remote_name" "master"; then
master_branch="master"
fi
if git ls-remote --exit-code --heads "$remote_name" "main"; then
master_branch="main"
fi
if [ -n "${master_branch}" ]; then
git checkout "${master_branch}"
fi
git pull
git fetch -p
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
echo "Processing branch: $branch_name"
if [ -n "${master_branch}" ]; then
git checkout "${branch_name}"
git pull
git merge origin/"${master_branch}" --no-edit
find . -name "package.json" -not -path "*/node_modules/*" | while read -r file; do
echo "Processing $file"
sed -i.bak -E 's/"typescript":\s*"<?~?([0-9]+\.)?([0-9]+\.)?[0-9]+"/"typescript": "'$stableVersion'"/' "$file"
echo "Updated $file"
done
find . -name "package.json.bak" -not -path "*/node_modules/*" -delete
git add .
git commit -am "Typescript Update to $stableVersion"
git push
gh pr merge $(gh pr list --base "${master_branch}" --head "${branch_name}" --json number --jq '.[0].number' | xargs echo) --auto --merge
git checkout "${master_branch}"
fi
done
cd ..
fi
done
cd project-signer || exit
2 changes: 2 additions & 0 deletions setTypescriptVersion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ for branch_name in $(git branch -r | grep -v '\->' | sed 's/origin\///' | grep -
echo "Updated $file"
done
find . -name "package.json.bak" -not -path "*/node_modules/*" -delete
git add .
git commit -am "Typescript Update to $stableVersion"
git push
gh pr merge $(gh pr list --base "${master_branch}" --head "${branch_name}" --json number --jq '.[0].number' | xargs echo) --auto --merge
git checkout "${master_branch}"
Expand Down

0 comments on commit 379ad0c

Please sign in to comment.