Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have sync-newspack-blocks.sh fail if phpcbf does #44294

Closed
Closed
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
11 changes: 10 additions & 1 deletion apps/full-site-editing/bin/sync-newspack-blocks.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

EXIT_CODE=0

# sed -i behaves differently between macos and linux platforms.
# See https://stackoverflow.com/a/51060063
# To use this, do `sed "${sedi[@]}" -e $sed_expression`
Expand Down Expand Up @@ -129,7 +131,12 @@ echo -n "eslint --fix: "
npx eslint . --fix > /dev/null 2>&1
echo "done"
echo -n "phpcbf: "
../../vendor/bin/phpcbf -q $TARGET | grep "A TOTAL OF" || echo '!! There was an error executing phpcbf'
../../vendor/bin/phpcbf -q $TARGET | grep "A TOTAL OF" || PHPCBF_ERRORED=1

if [ "$PHPCBF_ERRORED" = 1 ] ; then
echo '!! There was an error executing phpcbf'
EXIT_CODE=1
fi

if [ "$MODE" = "npm" ] ; then
# Finds and prints the version of newspack from package.json
Expand All @@ -150,3 +157,5 @@ then
echo
fi
fi

exit $EXIT_CODE