nimbleghost 2 лет назад
Родитель
Сommit
206ea312bf
4 измененных файлов с 30 добавлено и 2 удалено
  1. 8 1
      Makefile
  2. 2 0
      web/.prettierignore
  3. 16 0
      web/package-lock.json
  4. 4 1
      web/package.json

+ 8 - 1
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)')

+ 2 - 0
web/.prettierignore

@@ -0,0 +1,2 @@
+build/
+public/static/langs/

+ 16 - 0
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",

+ 4 - 1
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": {