diff --git a/Makefile b/Makefile index e3d9dfc2b..560ab0466 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md index 03f6b6939..732004ca1 100644 --- a/docs/DEVELOPMENT.md +++ b/docs/DEVELOPMENT.md @@ -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. diff --git a/ui/v2.5/package.json b/ui/v2.5/package.json index 1a35cd870..ca6816062 100644 --- a/ui/v2.5/package.json +++ b/ui/v2.5/package.json @@ -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",