diff --git a/Makefile b/Makefile index 76f46a8..6786acb 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,8 @@ help: @echo " make web - Build the web app" @echo " make web-deps - Install web app dependencies (npm install the universe)" @echo " make web-build - Actually build the web app" + @echo " make web-format - Run prettier on the web app + @echo " make web-format-check - Run prettier on the web app, but don't change anything @echo @echo "Build documentation:" @echo " make docs - Build the documentation" @@ -137,6 +139,11 @@ web-deps: web-deps-update: cd web && npm update +web-format: + cd web && npm run format + +web-format-check: + cd web && npm run format:check # Main server/client build @@ -226,7 +233,7 @@ cli-build-results: # Test/check targets -check: test fmt-check vet lint staticcheck +check: test web-format-check fmt-check vet lint staticcheck test: .PHONY go test $(shell go list ./... | grep -vE 'ntfy/(test|examples|tools)') diff --git a/web/.prettierignore b/web/.prettierignore new file mode 100644 index 0000000..d0097d3 --- /dev/null +++ b/web/.prettierignore @@ -0,0 +1,2 @@ +build/ +public/static/langs/ \ No newline at end of file diff --git a/web/package-lock.json b/web/package-lock.json index a233aee..d830d63 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -26,6 +26,7 @@ "stacktrace-js": "^2.0.2" }, "devDependencies": { + "prettier": "^2.8.8", "react-scripts": "^5.0.0" } }, @@ -15120,6 +15121,21 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-bytes": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", diff --git a/web/package.json b/web/package.json index a4a6907..1ca2da7 100644 --- a/web/package.json +++ b/web/package.json @@ -6,7 +6,9 @@ "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", - "eject": "react-scripts eject" + "eject": "react-scripts eject", + "format": "prettier . --write", + "format:check": "prettier . --check" }, "dependencies": { "@mui/icons-material": "^5.4.2", @@ -27,6 +29,7 @@ "stacktrace-js": "^2.0.2" }, "devDependencies": { + "prettier": "^2.8.8", "react-scripts": "^5.0.0" }, "browserslist": {