Add quick fmt/validate targets

This commit is contained in:
WithoutPants 2024-07-04 10:53:29 +10:00
parent a0b082a36d
commit d0caf87eeb
3 changed files with 17 additions and 0 deletions

View File

@ -372,6 +372,17 @@ fmt-ui:
validate-ui:
cd ui/v2.5 && yarn run validate
# these targets run the same steps as fmt-ui and validate-ui, but only on files that have changed
fmt-ui-quick:
cd ui/v2.5 && yarn run prettier --write $$(git diff --name-only --relative --diff-filter d . ../../graphql)
# does not run tsc checks, as they are slow
validate-ui-quick:
cd ui/v2.5 && \
yarn run eslint $$(git diff --name-only --relative --diff-filter d src | grep -e "\.tsx\?\$$") && \
yarn run stylelint $$(git diff --name-only --relative --diff-filter d src | grep "\.scss") && \
yarn run prettier --check $$(git diff --name-only --relative --diff-filter d . ../../graphql)
# runs all of the backend PR-acceptance steps
.PHONY: validate-backend
validate-backend: lint it

View File

@ -69,6 +69,9 @@ NOTE: The `make` command in OpenBSD will be `gmake`. For example, `make pre-ui`
* `make it` - Runs all unit and integration tests
* `make fmt` - Formats the Go source code
* `make fmt-ui` - Formats the UI source code
* `make validate-ui` - Runs tests and checks for the UI only
* `make fmt-ui-quick` - (experimental) Formats only changed UI source code
* `make validate-ui-quick` - (experimental) Runs tests and checks of changed UI code
* `make server-start` - Runs a development stash server in the `.local` directory
* `make server-clean` - Removes the `.local` directory and all of its contents
* `make ui-start` - Runs the UI in development mode. Requires a running Stash server to connect to - the server URL can be changed from the default of `http://localhost:9999` using the environment variable `VITE_APP_PLATFORM_URL`, but keep in mind that authentication cannot be used since the session authorization cookie cannot be sent cross-origin. The UI runs on port `3000` or the next available port.

View File

@ -12,6 +12,9 @@
"lint:css": "stylelint --cache \"src/**/*.scss\"",
"lint:js": "eslint --cache src/",
"check": "tsc --noEmit",
"eslint": "eslint",
"prettier": "prettier",
"stylelint": "stylelint",
"format": "prettier --write . ../../graphql",
"format-check": "prettier --check . ../../graphql",
"gqlgen": "gql-gen --config codegen.ts",