cardano-foundation / testnets-cardano-org

Official Cardano Testnets website repository
https://testnets.cardano.org/
MIT License
57 stars 34 forks source link

Performance optimizations #779

Open ioprojecton opened 2 months ago

ioprojecton commented 2 months ago

grep command not needed same can be done in git diff

no need to loop for file existance. Same can be achieved via xargs

redundant calls to npm run lint fixed

What? (required)

CHANGED_FILES=gitdiff --name-only --cached --relative | grep '\.jsx\?$' | xargs to CHANGED_FILES=$(git diff --name-only --cached --relative '.jsx' '.js' | xargs -r ls -1 2>/dev/null)

CHANGED_FILES_ARRAY=(${CHANGED_FILES// / }) RESOLVED_CHANGED_FILES="" for i in "${!CHANGED_FILES_ARRAY[@]}" do if [ -f "${CHANGED_FILES_ARRAY[i]}" ]; then RESOLVED_CHANGED_FILES+=" ${CHANGED_FILES_ARRAY[i]}" fi done if [ "$RESOLVED_CHANGED_FILES" != "" ]; then npm run lint:changed -- $RESOLVED_CHANGED_FILES if [ $? -ne 0 ]; then exit 1; fi fi to if [ -n "$CHANGED_FILES" ]; then npm run lint:changed -- $CHANGED_FILES [ $? -ne 0 ] && exit 1 fi

Why? (optional)

Why has this change occurred if applicable?

How can this be tested? (optional)

Describe how this change can be tested

Screenshots (optional)

Upload some screenshots of the changes

netlify[bot] commented 2 months ago

Deploy request for testnets-cardano pending review.

Visit the deploys page to approve it

Name Link
Latest commit 15c938d07ce84bbe17af06cd25e54e2c92a41d75