Skip to content

Commit 64e58c8

Browse files
author
David Ferlay
committed
Adding theme check for front tasks
1 parent 3b57f60 commit 64e58c8

File tree

1 file changed

+41
-17
lines changed

1 file changed

+41
-17
lines changed

scripts/makefile/front.mk

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,29 +59,53 @@ front-build:
5959
fi
6060

6161
lintval:
62-
@echo "Running theme linters..."
63-
docker pull $(IMAGE_FRONT)
64-
$(call frontexec, yarn run lint)
62+
@if [ -d $(shell pwd)/web/themes/custom/$(THEME_NAME) ]; then \
63+
echo "- Theme directory found. Running theme linters..."; \
64+
docker pull $(IMAGE_FRONT); \
65+
$(call frontexec, node -v); \
66+
$(call frontexec, yarn -v); \
67+
$(call frontexec, yarn run lint); \
68+
else \
69+
echo "- Theme directory defined in .env file was not found. Skipping theme linters."; \
70+
fi
6571

6672
lint:
67-
@echo "Running theme linters with fix..."
68-
docker pull $(IMAGE_FRONT)
69-
$(call frontexec, yarn install --ignore-optional --check-files --prod)
70-
$(call frontexec, yarn lint-fix)
73+
@if [ -d $(shell pwd)/web/themes/custom/$(THEME_NAME) ]; then \
74+
echo "- Theme directory found. Running theme linters with fix..."; \
75+
docker pull $(IMAGE_FRONT); \
76+
$(call frontexec, node -v); \
77+
$(call frontexec, yarn -v); \
78+
$(call frontexec, yarn install --ignore-optional --check-files --prod); \
79+
$(call frontexec, yarn lint-fix); \
80+
else \
81+
echo "- Theme directory defined in .env file was not found. Skipping theme linters with fix."; \
82+
fi
7183

7284
storybook:
73-
@echo "Running dynamic storybook..."
74-
docker pull $(IMAGE_FRONT)
75-
$(call frontexec, yarn install --ignore-optional --check-files)
76-
$(call frontexec, yarn run build);
77-
$(call frontexec-with-port, yarn storybook -p $(FRONT_PORT))
85+
@if [ -d $(shell pwd)/web/themes/custom/$(THEME_NAME) ]; then \
86+
echo "- Theme directory found. Running dynamic storybook..."; \
87+
docker pull $(IMAGE_FRONT); \
88+
$(call frontexec, node -v); \
89+
$(call frontexec, yarn -v); \
90+
$(call frontexec, yarn install --ignore-optional --check-files); \
91+
$(call frontexec, yarn run build); \
92+
$(call frontexec-with-port, yarn storybook -p $(FRONT_PORT)); \
93+
else \
94+
echo "- Theme directory defined in .env file was not found. Skipping dynamic storybook."; \
95+
fi
7896

7997
build-storybook:
80-
@echo "Export static storybook..."
81-
docker pull $(IMAGE_FRONT)
82-
$(call frontexec, yarn install --ignore-optional --check-files)
83-
$(call frontexec, yarn run build);
84-
$(call frontexec, yarn run build-storybook)
98+
@if [ -d $(shell pwd)/web/themes/custom/$(THEME_NAME) ]; then \
99+
echo "- Theme directory found. Exporting static storybook..."; \
100+
docker pull $(IMAGE_FRONT); \
101+
$(call frontexec, node -v); \
102+
$(call frontexec, yarn -v); \
103+
$(call frontexec, yarn install --ignore-optional --check-files); \
104+
$(call frontexec, yarn run build); \
105+
$(call frontexec, yarn run build-storybook); \
106+
else \
107+
echo "- Theme directory defined in .env file was not found. Skipping dynamic storybook."; \
108+
fi
85109

86110
create-component:
87111
@echo "Create component CLI dialog... It assumed that you already have 'make storybook' or 'make build-storybook' finished"

0 commit comments

Comments
 (0)