Skip to content

Commit 0760457

Browse files
Add debugging information for check format/format (#112)
1 parent 9f0e585 commit 0760457

File tree

3 files changed

+38
-13
lines changed

3 files changed

+38
-13
lines changed

.github/workflows/verify-code-formatting.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ jobs:
1111
steps:
1212
- name: 'Checkout code'
1313
uses: actions/checkout@v2
14-
14+
- name: Use Node.js LTS (14.x)
15+
uses: actions/setup-node@v1
16+
with:
17+
node-version: 14.x
1518
- name: 'Verify formatting of all files'
1619
run: ./bin/check-formatting.sh

bin/check-formatting.sh

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
#!/bin/bash
22

33
if [ -z "$EXERCISM_PRETTIER_VERSION" ]; then
4-
echo "Pulling prettier version from package.json"
5-
EXERCISM_PRETTIER_VERSION=$(npm list prettier | grep -Po '.*prettier@\K.*')
4+
echo "Pulling prettier version from package.json"
5+
EXERCISM_PRETTIER_VERSION=$(yarn list --pattern prettier | grep -Po '.*\sprettier@\K.*')
66
fi
77

88
if [ -z "$EXERCISM_PRETTIER_VERSION" ]; then
9-
echo "This script requires the EXERCISM_PRETTIER_VERSION variable to work."
10-
echo "Please see https://github.com/exercism/v3/blob/master/docs/maintainers/style-guide.md for guidance."
11-
exit 1
9+
echo "---------------------------------------------------"
10+
echo "This script requires the EXERCISM_PRETTIER_VERSION variable to work."
11+
echo "Please see https://exercism.org/docs/building/markdown/style-guide for guidance."
12+
echo "---------------------------------------------------"
13+
echo "This is what yarn list reports:"
14+
echo "$(yarn list prettier)"
15+
echo ""
16+
echo "This is the version that can be extracted:"
17+
echo "$(yarn list --pattern prettier | grep -Po '.*\sprettier@\K.*')"
18+
echo ""
19+
echo "These files are found in the repo root:"
20+
echo "$(ls -p | grep -v /)"
21+
echo "---------------------------------------------------"
22+
exit 1
1223
else
13-
echo "Running format with prettier@$EXERCISM_PRETTIER_VERSION"
24+
echo "Running format with prettier@$EXERCISM_PRETTIER_VERSION"
1425
fi
1526

1627
npx "prettier@$EXERCISM_PRETTIER_VERSION" --check "**/*.{js,jsx,ts,tsx,css,sass,scss,html,json,md,yml}"

bin/format.sh

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
#!/usr/bin/env bash
22

33
if [ -z "$EXERCISM_PRETTIER_VERSION" ]; then
4-
echo "Pulling prettier version from package.json"
5-
EXERCISM_PRETTIER_VERSION=$(npm list prettier | grep -Po '.*prettier@\K.*')
4+
echo "Pulling prettier version from package.json"
5+
EXERCISM_PRETTIER_VERSION=$(yarn list --pattern prettier | grep -Po '.*\sprettier@\K.*')
66
fi
77

88
if [ -z "$EXERCISM_PRETTIER_VERSION" ]; then
9-
echo "This script requires the EXERCISM_PRETTIER_VERSION variable to work."
10-
echo "Please see https://github.com/exercism/v3/blob/master/docs/maintainers/style-guide.md for guidance."
11-
exit 1
9+
echo "---------------------------------------------------"
10+
echo "This script requires the EXERCISM_PRETTIER_VERSION variable to work."
11+
echo "Please see https://exercism.org/docs/building/markdown/style-guide for guidance."
12+
echo "---------------------------------------------------"
13+
echo "This is what yarn list reports:"
14+
echo "$(yarn list prettier)"
15+
echo ""
16+
echo "This is the version that can be extracted:"
17+
echo "$(yarn list --pattern prettier | grep -Po '.*\sprettier@\K.*')"
18+
echo ""
19+
echo "These files are found in the repo root:"
20+
echo "$(ls -p | grep -v /)"
21+
echo "---------------------------------------------------"
22+
exit 1
1223
else
13-
echo "Running format with prettier@$EXERCISM_PRETTIER_VERSION"
24+
echo "Running format with prettier@$EXERCISM_PRETTIER_VERSION"
1425
fi
1526

1627
npx "prettier@$EXERCISM_PRETTIER_VERSION" --write "**/*.{js,jsx,ts,tsx,css,sass,scss,html,json,md,yml}"

0 commit comments

Comments
 (0)