[add] scripts

This commit is contained in:
2025-08-14 21:28:51 +01:00
parent b044536a3b
commit 9dc2e300dc
8 changed files with 960 additions and 16 deletions

View File

@@ -1,10 +1,17 @@
#!/bin/bash
IGNORE_REPOS=("source-map-support") # Add the list of repositories to ignore
# test repos
IGNORE_REPOS=("source-map-support" "jsdom" "eslint-utils" "polished" "webpack-bundle-analyzer" "jscodeshift" "chromium-bidi" "react-popper" "react-dropzone" "babel-plugin-styled-components" "unicode-trie" "relay-runtime" "react-element-to-jsx-string" "inline-style-prefixer" "karma" "cfb" "serve-handler") # Add the list of repositories to ignore
# set -e
rm -rf candidates
function fail {
printf '%s\n' "$1" >&2 ## Send message to stderr.
exit "${2-1}" ## Return a code specified by $2, or 1 by default.
}
# rm -rf candidates
mkdir -p candidates
rm -iv processed.log current.log success.txt
# Read the minableRepositories2.csv file (rows of repo,test script). Read the repo and copy it from the `cache` folder`
while IFS=, read -r repo test_script; do
@@ -23,25 +30,42 @@ while IFS=, read -r repo test_script; do
# Check if the repo directory exists in the cache folder
if [[ -d "../cache-repos/repos/$repo_name" ]]; then
echo "Processing repository: $repo_name"
echo "Processing repository: $repo_name" > current.log
echo "Processing repository: $repo_name" >> current.log
# Change to the repository directory
cp -r "../cache-repos/repos/$repo_name" "candidates/$repo_name" || exit
pushd "candidates/$repo_name" || exit
pnpm install || exit
popd || exit
if [[ -d "candidates/$repo_name" ]]; then
echo "Repository $repo_name already exists in candidates, skipping..."
if [[ -f "candidates/$repo_name/.done" ]]; then
echo "Skipping $repo_name as it has already been processed."
continue
else
echo "Processing $repo_name again as .done file is missing. Run it again."
rm -rf "candidates/$repo_name"
fi
# Uncomment the next line if you want to remove the existing directory
# rm -rf "candidates/$repo_name"
else
cp -r "../cache-repos/repos/$repo_name" "candidates/$repo_name" || exit
pushd "candidates/$repo_name" > /dev/null || fail "Failed to pushd"
npm install --silent || fail "Failed to npm i"
popd > /dev/null || fail "Failed to popd"
node src/index.mjs "candidates/$repo_name" >> processed.log
RESULT=$?
if [[ $RESULT -ne 0 ]]; then
echo "Error processing repository: $repo_name"
# exit $RESULT
else
echo "$repo_name">> "success.txt"
node src/index.mjs "candidates/$repo_name" >> processed.log 2>&1
RESULT=$?
echo "--Separator-- $repo_name" >> processed.log
touch "candidates/$repo_name/.done"
if [[ $RESULT -ne 0 ]]; then
echo "Error processing repository: $repo_name"
# exit $RESULT
else
echo "$repo_name">> "success.txt"
fi
fi
# Change back to the original directory
else
echo "Repository $repo_name not found in cache" || exit 1
fi
else
echo "Skipping empty repository entry $repo";
fi
done < minableRepositories2.csv