Skip to content

Commit 9a7f429

Browse files
Merge pull request #1580 from ASU/UDS-2060
UDS-2060: chore: add script to check git history if package-version has ever be…
2 parents 341ed1d + f3f5120 commit 9a7f429

File tree

2 files changed

+557
-0
lines changed

2 files changed

+557
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
# This script checks the git history for changes to yarn.lock that include
3+
# any of the packages listed in "effected-packages.txt"
4+
5+
# example format "effected-packages.txt":
6+
7+
8+
9+
10+
11+
12+
13+
# Usage from the root of your monorepo, run:
14+
# ./scripts/manual-vulnerability-check/check-git-history.sh
15+
packages=()
16+
while IFS= read -r line; do
17+
packages+=("$line")
18+
done < ./scripts/manual-vulnerability-check/effected-packages.txt
19+
i=0
20+
for package in "${packages[@]}"; do
21+
# modify package string from
22+
# @scope/package@version to @scope/package@npm:version
23+
# package@version to package@npm:version
24+
package=$(echo "$package" | sed -E 's/@([0-9]+\.[0-9]+\.[0-9]+)/@npm:\1/')
25+
# show progress
26+
echo "Line $((i+1)): $package"
27+
# search through git log for changes to yarn.lock
28+
# that include "package@npm:version"
29+
git log -p --all -- yarn.lock | grep -A 2 -B 2 -E "$package"
30+
((i++))
31+
done

0 commit comments

Comments
 (0)