Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions e2e/utoo-pm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,26 @@ utoo rebuild || { echo -e "${RED}FAIL: utoo rebuild failed for ant-design-x (nex
echo -e "${GREEN}PASS: ant-design-x (next) cloned and installed${NC}"
cd ../../

# Case 2: Clone and install ant-design
# Case 2: Clone and install ant-design - test manifests-concurrency-limit
echo -e "${YELLOW}Case 2: Clone and install ant-design${NC}"
cd ant-design
if [ ! -d "ant-design" ]; then
git clone --depth=1 --single-branch https://github.com/ant-design/ant-design.git
fi
cd ant-design
rm -rf ~/.cache/nm
echo "Installing dependencies for ant-design..."
utoo install --ignore-scripts || { echo -e "${RED}FAIL: utoo install failed for ant-design${NC}"; exit 1; }

# Test different manifests-concurrency-limit values
echo -e "${YELLOW}Testing different manifests-concurrency-limit values...${NC}"
for limit in 10 20 40 60 70 80 90 100 120 200; do
echo -e "${YELLOW}--- Testing manifests-concurrency-limit=$limit ---${NC}"
rm -rf node_modules package-lock.json
rm -rf ~/.cache/nm
time utoo install --ignore-scripts --manifests-concurrency-limit $limit || { echo -e "${RED}FAIL: utoo install failed with limit=$limit${NC}"; exit 1; }
echo -e "${GREEN}PASS: limit=$limit completed${NC}"
echo ""
done
Comment on lines +50 to +59
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This block of code is almost identical to the one used for ant-design-x (lines 27-36). To avoid code duplication and improve maintainability, this logic should be extracted into a reusable shell function.

You can define a function at the top of the script (e.g., after the color definitions) like this:

function test_concurrency_limits() {
  local project_name="$1"
  echo -e "${YELLOW}Testing different manifests-concurrency-limit values for ${project_name}...${NC}"
  for limit in 10 20 40 60 70 80 90 100 120 200; do
    echo -e "${YELLOW}--- Testing manifests-concurrency-limit=$limit ---${NC}"
    rm -rf node_modules package-lock.json
    rm -rf ~/.cache/nm
    time utoo install --ignore-scripts --manifests-concurrency-limit $limit || { echo -e "${RED}FAIL: utoo install failed for ${project_name} with limit=$limit${NC}"; exit 1; }
    echo -e "${GREEN}PASS: limit=$limit completed for ${project_name}${NC}"
    echo ""
  done
}

Then, you can replace this entire block with a single call to this function. The same function can then be used to refactor the test for ant-design-x.

Suggested change
# Test different manifests-concurrency-limit values
echo -e "${YELLOW}Testing different manifests-concurrency-limit values...${NC}"
for limit in 10 20 40 60 70 80 90 100 120 200; do
echo -e "${YELLOW}--- Testing manifests-concurrency-limit=$limit ---${NC}"
rm -rf node_modules package-lock.json
rm -rf ~/.cache/nm
time utoo install --ignore-scripts --manifests-concurrency-limit $limit || { echo -e "${RED}FAIL: utoo install failed with limit=$limit${NC}"; exit 1; }
echo -e "${GREEN}PASS: limit=$limit completed${NC}"
echo ""
done
test_concurrency_limits "ant-design"


utoo rebuild || { echo -e "${RED}FAIL: utoo rebuild failed for ant-design${NC}"; exit 1; }
echo -e "${GREEN}PASS: ant-design cloned and installed${NC}"
cd ../../

Expand Down