mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Check website format in CI (#2454)
Add a command to lint the website to package.json, and update the workflow. Updates docs for linting as well. --------- Co-authored-by: Jade Turner <spacey-sooty@proton.me>
This commit is contained in:
15
.github/workflows/website.yml
vendored
15
.github/workflows/website.yml
vendored
@@ -36,6 +36,9 @@ jobs:
|
||||
|
||||
format-check:
|
||||
name: Check Formatting
|
||||
defaults:
|
||||
run:
|
||||
working-directory: website
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
@@ -49,7 +52,11 @@ jobs:
|
||||
cache-dependency-path: website/pnpm-lock.yaml
|
||||
- name: Install Packages
|
||||
run: pnpm i --frozen-lockfile
|
||||
working-directory: website
|
||||
- name: Run Formatting Check
|
||||
run: pnpm prettier -c .
|
||||
working-directory: website
|
||||
- run: |
|
||||
set +e
|
||||
pnpm run format-ci
|
||||
exit_code=$?
|
||||
if test "$exit_code" -ne "0"; then
|
||||
echo "::error ::Linting failed. See https://docs.photonvision.org/en/latest/docs/contributing/linting.html"
|
||||
fi
|
||||
exit $exit_code
|
||||
|
||||
@@ -34,10 +34,16 @@ To install *doc8*, the python tool we use to lint our documentation, run `pipx i
|
||||
|
||||
To lint the documentation, run `doc8 docs` from the root level of the docs.
|
||||
|
||||
## Website
|
||||
|
||||
### Formatting the website
|
||||
|
||||
To format the website, run `pnpm -C website run format`.
|
||||
|
||||
## Alias
|
||||
|
||||
The following [alias](https://www.computerworld.com/article/1373210/how-to-use-aliases-in-linux-shell-commands.html) can be added to your shell config, which will allow you to lint the entirety of the PhotonVision project by running `pvLint`. The alias will work on Linux, macOS, Git Bash on Windows, and WSL.
|
||||
|
||||
```sh
|
||||
alias pvLint='wpiformat -v && ./gradlew spotlessApply && pnpm -C photon-client lint && pnpm -C photon-client format && doc8 docs'
|
||||
alias pvLint='wpiformat -v && ./gradlew spotlessApply && pnpm -C photon-client lint && pnpm -C photon-client format && doc8 docs && pnpm -C website format'
|
||||
```
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite-ssg build",
|
||||
"preview": "vite preview"
|
||||
"preview": "vite preview",
|
||||
"format": "prettier --write src/",
|
||||
"format-ci": "prettier --check src/"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@toolwind/anchors": "^1.0.10",
|
||||
|
||||
Reference in New Issue
Block a user