From 71023d9ba77f6db3ef07f2cd29f8c35c21b067c0 Mon Sep 17 00:00:00 2001 From: Henry Castro Date: Tue, 12 Mar 2024 08:27:57 -0400 Subject: [PATCH] browser: simplify 'prettier' call Change-Id: I0e2af38d70e30dea42187fa2fb960da5328af857 Signed-off-by: Henry Castro --- browser/Makefile.am | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/browser/Makefile.am b/browser/Makefile.am index 55bfdddfa..50efcecd1 100644 --- a/browser/Makefile.am +++ b/browser/Makefile.am @@ -479,6 +479,13 @@ define run_eslint_check --no-eslintrc $(1) endef +define run_prettier_check + @$(NODE) node_modules/.bin/prettier \ + --ignore-path $(srcdir)/browser/.prettierignore \ + --ignore-path $(srcdir)/browser/.beforeprettier \ + $(1) +endef + .PHONY: build-cool all-local: build-cool @@ -552,11 +559,7 @@ $(INTERMEDIATE_DIR)/admin-src.js: $(COOL_ADMIN_TS_JS) $(COOL_ADMIN_JS) @mkdir -p $(dir $@) @echo "Checking for admin JS errors..." $(call run_eslint_check,--ignore-pattern $(COOL_ADMIN_TS_JS) $(srcdir)/admin/src) - @$(NODE) node_modules/.bin/prettier \ - --ignore-path $(srcdir)/browser/.prettierignore \ - --ignore-path $(srcdir)/browser/.beforeprettier \ - --debug-check \ - $(srcdir)/admin/src + $(call run_prettier_check,--debug-check $(srcdir)/admin/src) @awk 'FNR == 1 {print ""} 1' $(COOL_ADMIN_TS_JS) $(patsubst %.js,$(srcdir)/%.js,$(COOL_ADMIN_JS)) > $@ $(INTERMEDIATE_DIR)/cool-src.js: tscompile.done $(call prereq_cool) $(COOL_JS_DST) $(abs_top_srcdir)/scripts/unocommands.py @@ -566,11 +569,7 @@ $(INTERMEDIATE_DIR)/cool-src.js: tscompile.done $(call prereq_cool) $(COOL_JS_DS @if ! test "z$(COOL_ASSERT_INTERSECT)" == "z"; then echo; echo "Error: please remove obsolete files:"; echo "$(COOL_ASSERT_INTERSECT)"; exit 1; else echo "clean"; fi @echo "Checking for cool JS errors..." $(call run_eslint_check,$(srcdir)/src $(srcdir)/js) - @$(NODE) node_modules/.bin/prettier \ - --ignore-path $(srcdir)/browser/.prettierignore \ - --ignore-path $(srcdir)/browser/.beforeprettier \ - --debug-check \ - $(srcdir)/src + $(call run_prettier_check,--debug-check $(srcdir)/src $(srcdir)/js/global.js) @echo "Bundling cool..." $(call bundle_cool)