Skip to content

Commit e853976

Browse files
authored
Merge pull request supabase#4266 from supabase/da/prettier-check
Run package-local prettier
2 parents ac72bfd + 1caf4dc commit e853976

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

.github/workflows/prettier.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,24 @@ jobs:
1313
uses: actions/checkout@v2
1414
- name: Run prettier
1515
run: |-
16-
npx prettier -c 'examples/**/*.{js,jsx,ts,tsx,css,md,json}'
16+
function run_check() {
17+
if $(grep -q '"prettier"' "$1") ; then
18+
pushd "$(dirname $1)"
19+
echo "Running prettier on $(pwd)"
20+
npx prettier -c '**/*.{js,jsx,ts,tsx,css,md,json}'
21+
popd
22+
fi
23+
}
24+
find . -type f -name 'package.json' ! -path '*node_modules*' -print0 | while IFS= read -r -d '' file; do
25+
run_check "$file"
26+
done
27+
28+
# i18n is not a node package, so we handle that one separately
29+
format-i18n:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Check out repo
33+
uses: actions/checkout@v2
34+
- name: Run prettier
35+
run: |-
1736
npx prettier -c 'i18n/**/*.{js,jsx,ts,tsx,css,md,json}'
18-
npx prettier -c 'www/**/*.{js,jsx,ts,tsx,css,md,json}'

0 commit comments

Comments
 (0)