[fix] new repos

This commit is contained in:
2025-08-19 20:13:24 +01:00
parent ed3e328b99
commit 094eca8da0
3 changed files with 36 additions and 12 deletions

View File

@@ -3,7 +3,7 @@
# This script processes a given repository by replacing its node_modules with the ones from the dist folder.
# The dist folder is expected to contain the base folder name of the repository, then inside that will be sliced dependencies.
# Usage: ./script-placer.sh <repo_location>
set -x
fail() {
echo "Error: $1"
exit "${2-1}" ## Return a code specified by $2, or 1 by default.
@@ -17,10 +17,10 @@ if [[ -z "$REPO_FOLDER" ]]; then
fi
pushd "$REPO_FOLDER"
npm i --silent || fail "Failed to install dependencies"
rm -rf node_modules_2
npm i || fail "Failed to install dependencies"
rm -rf .node_modules node_modules_2
npm run test >> ../coverage/$REPO_BASE-pre.json
less ../coverage/$REPO_BASE-pre.json
# less ../coverage/$REPO_BASE-pre.json
if [[ $? -ne 0 ]]; then
echo "Tests failed in $REPO_FOLDER"
echo "$REPO_FOLDER" >> ../coverage/pre-failed.txt
@@ -37,9 +37,9 @@ if [[ $PRE_TEST_RESULT -ne 0 ]]; then
fi
pushd "$REPO_FOLDER"
mv node_modules node_modules_2
NODE_PATH="/home/atreyab/Documents/Docs/SlicingImport/repos-js/safeImport/dist/$REPO_BASE:/home/atreyab/Documents/Docs/SlicingImport/repos-js/candidates-repos/$REPO_BASE/node_modules_2" npm run test >> ../coverage/$REPO_BASE-post.txt
less ../coverage/$REPO_BASE-post.txt
mv node_modules .node_modules
NODE_PATH="/home/atreyab/Documents/Docs/SlicingImport/repos-js/safeImport/dist/$REPO_BASE:/home/atreyab/Documents/Docs/SlicingImport/repos-js/candidates-repos/$REPO_BASE/.node_modules" npm run test #>> ../coverage/$REPO_BASE-post.txt
# less ../coverage/$REPO_BASE-post.txt
POST_TEST_RESULT=$?
# if post test is true, or both are false, then we can proceed
if [[ $POST_TEST_RESULT -ne 0 && $PRE_TEST_RESULT -ne 0 ]]; then

View File

@@ -1,6 +1,6 @@
#!/bin/bash
# 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
# run slicer
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" "rxjs" "d3-array" "lie" "@cspotcode/source-map-support" "d3-shape" "pac-resolver" "ts-loader" "pgpass" "less" "d3-geo" "rollup-plugin-terser" "seek-bzip" "brotli" "d3-contour" "nearley" "zig" "liftoff" "tslint" "react-syntax-highlighter" "xml-js" "web3-utils" "react-focus-lock" "clipboard" "css-vendor" "fontkit" "append-buffer" "react-color" "aws-cdk-lib" "jest-serializer-html" "fontkit" "@aws-cdk/core") # Add the list of repositories to ignore
# set -e
@@ -20,9 +20,11 @@ while IFS=, read -r repo test_script; do
if [[ -n "$repo" ]]; then
# If the repo belongs to a given list, ignore it
if [[ " ${IGNORE_REPOS[@]} " =~ " ${repo} " ]]; then
if [[ "${IGNORE_REPOS[@]}" =~ "${repo}" ]]; then
echo "Ignoring repository: $repo"
continue
else
echo "Processing repository: $repo"
fi
# Extract the repo name from the URL
repo_name=$(basename "$repo" .git)
@@ -46,9 +48,15 @@ while IFS=, read -r repo test_script; do
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"
npm install --silent
NPMI_RESULT=$?
popd > /dev/null || fail "Failed to popd"
if [[ $NPMI_RESULT -ne 0 ]]; then
echo "npm install failed for $repo_name, skipping..."
echo "$repo_name" >> "failed-install.txt"
continue
fi
node src/index.mjs "candidates/$repo_name" >> processed.log 2>&1
RESULT=$?

View File

@@ -42,7 +42,23 @@ const FILTER_LIST = [
"https://github.com/segmentio/analytics.js-video-plugins",
"https://github.com/cucumber/cucumber-expressions-javascript",
"https://github.com/jakwings/node-temp-fs",
"https://github.com/bower/bower/tree/master/packages/*"
"https://github.com/bower/bower/tree/master/packages/*",
"https://github.com/applitools/rendering-grid",
"https://github.com/timkendrick/maximatch",
"https://github.com/jonschlinkert/is-valid-instance",
"https://github.com/applitools/eyes.sdk.javascript1",
"https://github.com/cssinjs/jss-nested",
"https://github.com/cssinjs/jss-camel-case",
"https://github.com/serverlessinc/utils-china",
"https://github.com/eugeneware/jwt-encode",
"https://github.com/aws/aws-cdk", //doesnt slice anyways
"https://github.com/cssinjs/jss-vendor-prefixer",
"https://github.com/inf3rno/o3",
"https://github.com/inf3rno/error-polyfill",
"https://github.com/spenceralger/rcfinder",
"https://github.com/okta/okta-idx-js",
"https://github.com/cssinjs/jss-compose",
"https://github.com/kaazing/node-http2"
];
const FILTER_LIST_REGEX = FILTER_LIST.map(GlobToRegExp)