From 206ea312bfadf6f73439673c1383dbfafca2b673 Mon Sep 17 00:00:00 2001 From: nimbleghost <132819643+nimbleghost@users.noreply.github.com> Date: Tue, 23 May 2023 20:54:00 +0200 Subject: [PATCH] Add prettier --- Makefile | 9 ++++++++- web/.prettierignore | 2 ++ web/package-lock.json | 16 ++++++++++++++++ web/package.json | 5 ++++- 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 web/.prettierignore diff --git a/Makefile b/Makefile index 76f46a84..6786acbe 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 00000000..d0097d35 --- /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 a233aeef..d830d63c 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 a4a6907e..1ca2da7d 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": {