shiori/scripts/styles_check.sh
cbe 7765e5bf42
chore: frontend formatting (#764)
* Install `prettier`

Ignore everything in the first step as I want to see the size of changes
that are going to happen first

* Configure prettier

- use tabs as the whole project prefers tabs
- ignore a bunch of files that shouldn't be formatted

* Check & format with prettier when compiling less

* Update docs to use bun

Since bun handles the dependencies used for the CSS compilation this
should be the preferred method from now on.

* Check actual result of prettier

* Use LF line endings

All files where formatted in LF and since it's most common in git repos
we should probably keep it this way

* Limit prettier to `internal/view/`

See pull request review
https://github.com/go-shiori/shiori/pull/764#pullrequestreview-1702935417

* Format code with prettier
2023-11-05 11:02:31 +01:00

23 lines
779 B
Bash
Executable file

#!/bin/bash
# This script is used to check if the style.css file is up to date.
# Check if the git tree for CWD is clean
if [ -n "$(git status internal/view/assets/css --porcelain)" ]; then
echo "❌ git tree is not clean. Please commit all changes before running this script."
exit 1
fi
# Check if prettier is ok
if ! bun x prettier internal/view/ --check; then
echo "❌ code style issues found. Please run 'make styles' and commit the changes."
exit 1
fi
# Check style.css file
CLEANCSS_OPTS=${CLEANCSS_OPTS} make styles
if [ -n "$(git status internal/view/assets/css --porcelain)" ]; then
echo "❌ style.css wasn't built from less changes. Please run 'make styles' and commit the changes."
git checkout -- internal/view/assets/css/
exit 1
fi