-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
01fefc5
commit 7b6a1ae
Showing
13 changed files
with
7,912 additions
and
4,731 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
nodeLinker: node-modules | ||
|
||
yarnPath: .yarn/releases/yarn-3.6.0.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,51 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
if [ -z "$EXERCISM_PRETTIER_VERSION" ]; then | ||
echo "Pulling prettier version from package.json" | ||
EXERCISM_PRETTIER_VERSION=$(yarn list --pattern prettier | grep -Po '.*\sprettier@\K.*') | ||
set -uo pipefail | ||
|
||
if [ -z "${EXERCISM_PRETTIER_VERSION:-}" ]; then | ||
echo "[format] pulling prettier version from yarn.lock using sed" | ||
EXERCISM_PRETTIER_VERSION="$(yarn info prettier --json --name-only | sed -n -e 's/^"prettier@npm://' -e 's/"//p')" | ||
echo "[format] expected version is now ${EXERCISM_PRETTIER_VERSION:-}" | ||
fi | ||
|
||
if [ -z "${EXERCISM_PRETTIER_VERSION:-}" ]; then | ||
echo "Version could not be pulled using sed" >&2 | ||
echo "[format] pulling prettier version from yarn.lock using grep" | ||
EXERCISM_PRETTIER_VERSION="$(yarn info prettier --json --name-only | grep -Po '"prettier@npm:\K[^"]+')" | ||
echo "[format] expected version is now ${EXERCISM_PRETTIER_VERSION:-}" | ||
fi | ||
|
||
if [ -z "$EXERCISM_PRETTIER_VERSION" ]; then | ||
if [ -z "${EXERCISM_PRETTIER_VERSION:-}" ]; then | ||
echo "Version could not be pulled using grep or sed" >&2 | ||
echo "" | ||
echo "---------------------------------------------------" | ||
echo "This script requires the EXERCISM_PRETTIER_VERSION variable to work." | ||
echo "Please see https://exercism.org/docs/building/markdown/style-guide for guidance." | ||
echo "---------------------------------------------------" | ||
echo "This is what yarn list reports:" | ||
echo "$(yarn list prettier)" | ||
echo "$(yarn -v)" | ||
echo "" | ||
echo "This is what yarn why reports:" | ||
echo "$ yarn why prettier" | ||
echo "$(yarn why prettier)" | ||
echo "" | ||
echo "And yarn info reports the following:" | ||
echo "$ yarn info prettier --name-only" | ||
echo "$(yarn info prettier --name-only)" | ||
echo "" | ||
echo "This is the version that can be extracted using grep:" | ||
echo "$ yarn info prettier --json --name-only | grep -Po '"prettier@npm:\K[^"]+'" | ||
echo "└─ $(yarn info prettier --json --name-only | grep -Po '"prettier@npm:\K[^"]+')" | ||
echo "" | ||
echo "This is the version that can be extracted:" | ||
echo "$(yarn list --pattern prettier | grep -Po '.*\sprettier@\K.*')" | ||
echo "This is the version that can be extracted using sed:" | ||
echo "$ yarn info prettier --json --name-only | sed -n -e 's/^"prettier@npm://' -e 's/"//p'" | ||
echo "└─ $(yarn info prettier --json --name-only | sed -n -e 's/^"prettier@npm://' -e 's/"//p')" | ||
echo "" | ||
echo "These files are found in the repo root:" | ||
echo "$(ls -p | grep -v /)" | ||
echo "---------------------------------------------------" | ||
exit 1 | ||
else | ||
echo "Running format with prettier@$EXERCISM_PRETTIER_VERSION" | ||
echo "[format] running with prettier@$EXERCISM_PRETTIER_VERSION" | ||
fi | ||
|
||
npx "prettier@$EXERCISM_PRETTIER_VERSION" --check "**/*.{js,jsx,ts,tsx,css,sass,scss,html,json,md,yml}" | ||
yarn dlx "prettier@$EXERCISM_PRETTIER_VERSION" --check "**/*.{js,jsx,ts,tsx,css,sass,scss,html,json,md,yml}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,51 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ -z "$EXERCISM_PRETTIER_VERSION" ]; then | ||
echo "Pulling prettier version from package.json" | ||
EXERCISM_PRETTIER_VERSION=$(yarn list --pattern prettier | grep -Po '.*\sprettier@\K.*') | ||
set -uo pipefail | ||
|
||
if [ -z "${EXERCISM_PRETTIER_VERSION:-}" ]; then | ||
echo "[format] pulling prettier version from yarn.lock using sed" | ||
EXERCISM_PRETTIER_VERSION="$(yarn info prettier --json --name-only | sed -n -e 's/^"prettier@npm://' -e 's/"//p')" | ||
echo "[format] expected version is now ${EXERCISM_PRETTIER_VERSION:-}" | ||
fi | ||
|
||
if [ -z "${EXERCISM_PRETTIER_VERSION:-}" ]; then | ||
echo "Version could not be pulled using sed" >&2 | ||
echo "[format] pulling prettier version from yarn.lock using grep" | ||
EXERCISM_PRETTIER_VERSION="$(yarn info prettier --json --name-only | grep -Po '"prettier@npm:\K[^"]+')" | ||
echo "[format] expected version is now ${EXERCISM_PRETTIER_VERSION:-}" | ||
fi | ||
|
||
if [ -z "$EXERCISM_PRETTIER_VERSION" ]; then | ||
if [ -z "${EXERCISM_PRETTIER_VERSION:-}" ]; then | ||
echo "Version could not be pulled using grep or sed" >&2 | ||
echo "" | ||
echo "---------------------------------------------------" | ||
echo "This script requires the EXERCISM_PRETTIER_VERSION variable to work." | ||
echo "Please see https://exercism.org/docs/building/markdown/style-guide for guidance." | ||
echo "---------------------------------------------------" | ||
echo "This is what yarn list reports:" | ||
echo "$(yarn list prettier)" | ||
echo "$(yarn -v)" | ||
echo "" | ||
echo "This is what yarn why reports:" | ||
echo "$ yarn why prettier" | ||
echo "$(yarn why prettier)" | ||
echo "" | ||
echo "And yarn info reports the following:" | ||
echo "$ yarn info prettier --name-only" | ||
echo "$(yarn info prettier --name-only)" | ||
echo "" | ||
echo "This is the version that can be extracted using grep:" | ||
echo "$ yarn info prettier --json --name-only | grep -Po '"prettier@npm:\K[^"]+'" | ||
echo "└─ $(yarn info prettier --json --name-only | grep -Po '"prettier@npm:\K[^"]+')" | ||
echo "" | ||
echo "This is the version that can be extracted:" | ||
echo "$(yarn list --pattern prettier | grep -Po '.*\sprettier@\K.*')" | ||
echo "This is the version that can be extracted using sed:" | ||
echo "$ yarn info prettier --json --name-only | sed -n -e 's/^"prettier@npm://' -e 's/"//p'" | ||
echo "└─ $(yarn info prettier --json --name-only | sed -n -e 's/^"prettier@npm://' -e 's/"//p')" | ||
echo "" | ||
echo "These files are found in the repo root:" | ||
echo "$(ls -p | grep -v /)" | ||
echo "---------------------------------------------------" | ||
exit 1 | ||
else | ||
echo "Running format with prettier@$EXERCISM_PRETTIER_VERSION" | ||
echo "[format] running with prettier@$EXERCISM_PRETTIER_VERSION" | ||
fi | ||
|
||
npx "prettier@$EXERCISM_PRETTIER_VERSION" --write "**/*.{js,jsx,ts,tsx,css,sass,scss,html,json,md,yml}" | ||
yarn dlx "prettier@$EXERCISM_PRETTIER_VERSION" --write "**/*.{js,jsx,ts,tsx,css,sass,scss,html,json,md,yml}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.