This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add prettier2/prettier3 scripts for sanity checks
- Loading branch information
1 parent
c408323
commit e9584a9
Showing
2 changed files
with
30 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
cleanup() { | ||
rm node_modules/prettier | ||
} | ||
|
||
run() { | ||
echo "$@" | ||
$@ | ||
} | ||
|
||
if [[ $PRETTIER_MAJOR = 3 ]]; then | ||
prettier='./prettier3' | ||
cmd="./node_modules/prettier3/bin/prettier.cjs --plugin ./dist/index.js --parser=liquid-html --ignore-path=.prettierignore" | ||
else | ||
prettier='./prettier2' | ||
cmd="./node_modules/prettier2/bin-prettier.js --plugin . --parser=liquid-html" | ||
fi | ||
|
||
# format with prettier2 | ||
ln -s $prettier node_modules/prettier | ||
|
||
# cleanup when done | ||
trap cleanup EXIT | ||
|
||
# run command for version | ||
run $cmd "$@" |